Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JRadioButton!!!

 
vikas de
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,
i have added JRadioButtons in my app...the prob is that i can select all RadioButtons instead of one...(Very Strange to me )i want that the user can only select one...!???
please help its urgent
vikas
feel free to mail me vikasde@usa.net & vikasde@rediffmail.com
 
Bill Prentice
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you need a button group, something like this:-
ButtonGroup slotStatusRadioButtonGroup = new ButtonGroup();

JRadioButton notSelectedRadioButton = new JRadioButton(notSelectedText, true);
JRadioButton selectedRadioButton = new JRadioButton(selectedText, false);
JRadioButton markedRadioButton = new JRadioButton(markedText, false);
slotStatusRadioButtonGroup.add(notSelectedRadioButton);
slotStatusRadioButtonGroup.add(selectedRadioButton);
slotStatusRadioButtonGroup.add(markedRadioButton);
Obviously you would intialise the JRadioButtons to meet your own requirements.
Hope this helps
Bill
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic