jQuery in Action, 3rd edition
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
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "change card (cardlayout) in netbeans" Watch "change card (cardlayout) in netbeans" New topic

change card (cardlayout) in netbeans

Jon Menzies

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:

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
I agree. Here's the link: http://aspose.com/file-tools
subject: change card (cardlayout) in netbeans
It's not a secret anymore!