-
ItemListener question
I have three radio buttons that are set into a group to enable only 1 selection. I have set itemlisteners to all 3 buttons.
When the user clicks 1 of the buttons, they are prompted using YES_NO dialog box'asking them to confirm the change'.
My problem is this: If they decide not to proceed, the newly seleted button becomes the current active choice. How can I prevent this from happening?
I mean how can I set a radiobutton but without calling the listeners method?
-
If the user decides to click no on the dialog i don't think that there is a way of preventing the new button selection to take place. The only thing i could think of would be to change back to the previous button if the user selects no.
-
Code:
public void actionPerformed(ActionEvent ae){
int i = JOptionPane.showConfirmDialog(jf, "Please confirm!", "Confirm", JOptionPane.YES_NO_OPTION);
if(i == JOptionPane.NO_OPTION){
// Need to get back to the previously selected button!
}
}
}