This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Problem with JRadioButton Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Problem with JRadioButton " Watch "Problem with JRadioButton " New topic
Author

Problem with JRadioButton

Mihir Sen
Greenhorn

Joined: Jul 16, 2001
Posts: 2
hi friends,
I am developing one ExamSimulator. at a time one question and three options will display on a screen.
I have three JRadioButtons and i have added those three in one ButtonGroup so that at a time only one will get selected.Now while displaying next question i want all the options should be unchecked. how to achieve this?
i am using setSelected(false) method of JRadioButton. but i am not getting the expected result.
expecting your help
-Mihir
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

I believe that the way a JRadio Button works is one always has to be selected. I may be wrong, but in my experience with them, it seems that one radio button has to be the default answer. I would like to be proven wrong though.


GenRocket - Experts at Building Test Data
Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
Hi Mihir,
Gregg's logic is correct. However, humans are easily fooled. The following code will perform what you want.

Enjoy,
Manfred.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with JRadioButton
 
Similar Threads
10 shuffling question
JRadioButtons w/a JButton
Save Problem bcz of Diff Panels
JOptionPane with lable and textfield
basic radiobutton question