Reputation: 79
I am developing a project in java. I have a MainFrame, in this MainFrame I have some MyJPanel classes, and in Panels I have some MyJToggleButton classes.
Now, I am confused in some point. I would like to do this; When a MyJToggleButton is pressed,other MyJToggleButtons in other MyJPanels shell be selected.
Generally I have this kind of problems. In MyJPanel, I don't have the other panel's buttons nor methods.
I hope I could explain my problem, Thanks for your help
Upvotes: 0
Views: 77
Reputation: 2365
I suppose you represent the same thing with MyJToggleButtons.
What I may advice is to use MVC design pattern. You split your application to the Model part and View part. Controller part then listens to View and/or Model and every time change occurs in Model/View things are updated. Especially if you represent something in GUI in different places, both places would get a message from a Controller to be updated, because model changed.
Upvotes: 1
Reputation: 2296
You describe something like this:
MainFrame
|
|_ MyJPanel.class
| |
| |_MyJToggleButton
|
|_otherMyPanel.class
|
|_otherMyJToggleButton
These are all View-Classes that represent some data to the user. If you want to add functionality you should write them in a controller. And your Business-Logic in a Model. You should read about MVC-Pattern
Upvotes: 1