File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

radio buttons and button groups

 
Mike Johns
Greenhorn
Posts: 10
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have 5 radio buttons I have added to a button group, initially they are all false. I want to reset them all to false after one run through system. The method setSelected(false) is not resetting my radio buttons to false and therefore not clearing them. Any ideas?
 
Anonymous
Ranch Hand
Posts: 18944
  • 0
  • send pies
  • Quote
  • Report post to moderator
The method you are looking for is part of CheckboxGroup, not Checkbox its self. You can do it like this:
<PRE>
CheckboxGroup c = new CheckboxGroup();
...
c.setSelectedCheckbox(null); // sets all Checkboxes in this group to false
</PRE>

HTH
 
Mike Johns
Greenhorn
Posts: 10
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem is CheckboxGroup will not let me add a JRadioButton. Do you know of anything that will work will JRadioButton?
Thanks for trying
 
Glen Tanner
Ranch Hand
Posts: 147
Java Python Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is a bit of a hack, but if you add an invisible button to the group, you can select it to clear all the others...
 
Mike Johns
Greenhorn
Posts: 10
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Glen,
It may be a hack, but it works!
Thanks,
Mike
 
Glen Tanner
Ranch Hand
Posts: 147
Java Python Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cool! I'm glad it worked.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic