This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Swing / AWT / SWT and the fly likes change card (cardlayout) in netbeans Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "change card (cardlayout) in netbeans" Watch "change card (cardlayout) in netbeans" New topic
Author

change card (cardlayout) in netbeans

Jon Menzies
Greenhorn

Joined: Dec 06, 2003
Posts: 1
I have created 2 panels
on the left is a menu panel with buttons. i want to use these buttons to change the card shown in cardlayout on the right side panel.
The name of the panel on the right is mainPanel and the card name is Student_Home
what do i add to the button in order to change card ?
thanks for your help
Jose Botella
Ranch Hand

Joined: Jul 03, 2001
Posts: 2120
Welcome to the Ranch Jon.
This from the CardLayout API:

show
public void show(Container parent,
String name)
Flips to the component that was added to this layout with the specified name, using addLayoutComponent. If no such component exists, then nothing happens.

Regarding Neatbeans I think you will need to access the proper Container and call getLayout on it.
[ December 07, 2003: Message edited by: Jose Botella ]

SCJP2. Please Indent your code using UBB Code
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: change card (cardlayout) in netbeans