Blerdijan Koliqi
Blerdijan Koliqi

Reputation: 27

JradioButton that is in ButtonGroup to setSelected

I have two JRadioButtons: SabiranjeradioButton (which I put in ButtonGroup) and Dijeljenjerdbtn (which I did NOT put in a ButtonGroup). I want to make a Reset Button so when I click the button the program should be as it opened.

The problem is that I tried to use the method .setSelected(false) to remove the select from the JRadioButtons but it does not work for the SabiranjeradioButton (which I put in ButtonGroup).

Can anyone help me?

Upvotes: 0

Views: 181

Answers (1)

George Z.
George Z.

Reputation: 6808

A ButtonGroup does not let all of the RadioButtons to be unselected at the same time. You can clear the selection manually via the ButtonGroup#clearSelection method.

Clears the selection such that none of the buttons in the ButtonGroup are selected.

Upvotes: 1

Related Questions