Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newbie...Checkbox on JSP

Status
Not open for further replies.

hhnova

Programmer
Joined
Jan 3, 2003
Messages
1
Location
US
I am trying to use 2 checkboxes on my page and have one checked if the other is not. Specs say not to have both checked at the same time. However, that is where I am stuck. I have 2 checkboxes, but can check them both. How do I do one or the other? Code example would be awesome, as this is my first time writing Java code and have 0 experience or exposure!
Thanks!
 
What you're trying to create are "Radio buttons". In swing you create a CheckboxGroup and pass it to your Checkboxes when you create them.


CheckboxGroup cbg = new CheckboxGroup();
panel.add(new Checkbox("one", cbg, true));
panel.add(new Checkbox("two", cbg, false));
panel.add(new Checkbox("three", cbg, false));
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top