Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

RadioGroup with JRadioButton

 
Ayman Jaffar
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,
By default JRadioButtons are not selected, but when I select one radio button, and then press the clear button, they DONT come back to that formal status. I've searched through all the methods for RadioGroup but was unsuccessful in finding a solution to this problem (deselecting all the JRadioButtons) does anyone have a suggestion.
thx,
Ayman.
 
Manish Hatwalne
Ranch Hand
Posts: 2596
Android Firefox Browser Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you meant ButtonGroup by RadioGroup....
Deselecting all radio button API has not been provided by Java. This is from Java Tutorial -

You should generally initialize a group of radio buttons so that one is selected. However, the API doesn't enforce this rule � a group of radio buttons can have no initial selection. Once the user has made a selection, exactly one button is selected from then on. There's no supported API for unselecting all the buttons.

Version Note: In versions prior to 1.4, invoking setSelected(null, true) on the ButtonGroup happened to deselect all the buttons. It no longer does so.

So in case you have liberty of using < JDK 1.4, you can try this workaround.
HTH,
- Manish
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!