This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Radio Button Selection Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Radio Button Selection Problem" Watch "Radio Button Selection Problem" New topic
Author

Radio Button Selection Problem

Jan Tang
Greenhorn

Joined: Sep 23, 2003
Posts: 9
hi all
I am pretty new to java. I set up a ButtonGroup which contains 3 RadioButtons. When I pressed "Load" button the form will retrieve the data from a database and display the relevant information of the specific record.Then I made a new button called "new record" to clear all the information 'DISPLAYED' on the form. The actionPerformed of "new record" button is:


all the information within the textfields was cleared since I pressed the button, however, the selected RadioButton is still selected which I thought there should be no radiobutton selected after pressing the button.

Can anyone help me out here? Really appreciate!

cheers
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
in a buttonGroup, once a selection has been made, one must always be selected

workarounds
1) add a dummy button to the group, but do not display it.
instead of setting the current selection to false, you set the dummy to be selected
2) remove the selected button from the button group, set its selection to false,
then re-add it to the button group
Jan Tang
Greenhorn

Joined: Sep 23, 2003
Posts: 9
Originally posted by Michael Dunn:
in a buttonGroup, once a selection has been made, one must always be selected

workarounds
1) add a dummy button to the group, but do not display it.
instead of setting the current selection to false, you set the dummy to be selected
2) remove the selected button from the button group, set its selection to false,
then re-add it to the button group


OK,now I get it. I've tried to make a dummy button before but I just thought there could be some better ways to solve this problem. It seems that I'd better add that button again now.Thanks for your help buddy.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Radio Button Selection Problem
 
Similar Threads
radio button question
basic radiobutton question
no RadioButtonCell in GWT 2.4 Cell?
iText issue- how to read filled PDF from from a hashmap.
table using lwuit in j2me