aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Reloading Panels in a CardLayout. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Reloading Panels in a CardLayout." Watch "Reloading Panels in a CardLayout." New topic
Author

Reloading Panels in a CardLayout.

Somnath Mallick
Ranch Hand

Joined: Mar 04, 2009
Posts: 477
Hello Everyone,

Its been years since I have done something with swing/awt. Just wanted to know, that in a card layout, how do you refresh one of the panels depending upon the changes of another panel.

My scenario is:
I have 3 panels in a card layout, when first loading the UI, the first panel has two radio buttons and one of them in disabled. Now on the second panel, if the user makes some changes, the radio button should be enabled when the user visits the first panel again. Right now, I am not able to achieve this. I googled a lot but did not find answers to this.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18110
    
    8

You use a reference to the radio button on the first panel, and you call its setEnabled(true) method when the user makes those changes in the second panel.

Really, it's as simple as that. However it seems like you haven't written your controller code so that it has a reference to that radio button. You should fix that problem. The controller code which is called when the second panel's action listener is called (or whatever it is which reacts to those changes) should also have a variable which refers to that radio button.
Somnath Mallick
Ranch Hand

Joined: Mar 04, 2009
Posts: 477
OK... Maybe for this one, i was doing way too much thinking!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Reloading Panels in a CardLayout.
 
Similar Threads
JDBC Application objects (query each time)?
Which Design Pattern and how to design using OOP this scenaria
Table Viewer GUI from a Database
SQL error
Understanding creating a "super" class obj from a "subclass" object