Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (9.5k points)

I’m using  Java 1.3.1 and Swing for my swing application which has radio buttons. In the ButtonGroup, when I perform getSelection() to return ButtonModel, I get unpredictable results with getActionCommand. I perform Enumeration with getElements(). But I have to loop through each button just to check which JRadioButton is selected. Can anyone tell me is there an easy way to do this?

1 Answer

0 votes
by (19.7k points)

You can loop through JRadioButtons and call isSelected() to access them directly instead of getting to the models from ButtonGroup.

Interested in Java? Check out this Java Certification by Intellipaat.   

Related questions

Browse Categories

...