• Post Reply Bookmark Topic Watch Topic
  • New Topic

Save Problem bcz of Diff Panels

 
Ashwin Kumar
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have three tabs (image buttons), on each tab I have gui desinged with( radio buttons and text boxes). so each tab has a Panel and each Panel has a 'Save' Button. So when I load the gui with all the existing data from database Panel one loads up and I make changes in Panel one click Save..FAILS bcz i dont get the radio button data from the other two panels so the save fails. I am using the following method to get the radio button selected. All the code is one one Java file only.
public static JRadioButton getSelection(ButtonGroup group) {
for (Enumeration e=group.getElements(); e.hasMoreElements(); ) {
JRadioButton b = (JRadioButton)e.nextElement();
if (b.getModel() == group.getSelection()) {
return b;
}
}
return null;
}
Please suggest how to solve this problem.
 
Stuart Gray
Ranch Hand
Posts: 410
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since the data in the tabs are dependent on each other it would make more sense to have one save button for everything (at the bottom), surely?

Also, are you trying to save the JRadioButton itself or the data it represents? I think part of this problem could be solved by a deeper look at M-V-C.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!