Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / March 2006

Tip: Looking for answers? Try searching our database.

2 radio button groups

Thread view: 
Duane Evenson - 16 Mar 2006 11:01 GMT
I would like to have a set of JRadioButtonMenuItem's and JRadioButtons
referring to the same group. Selecting the "red" radio button in the
menu will also set the "red" radio button on the panel. How do I go
about referring two or more radio buttons to the same group element.
All I can figure is having two groups, two listeners, and each listener
copy its changed group model to the other group.
Is there a more elegant solution?
Vova Reznik - 16 Mar 2006 16:26 GMT
> I would like to have a set of JRadioButtonMenuItem's and JRadioButtons
> referring to the same group. Selecting the "red" radio button in the
[quoted text clipped - 3 lines]
> copy its changed group model to the other group.
> Is there a more elegant solution?

You may share ButtonModel:
redRadioButtonMenu.setModel(redRadioButton.getModel());
and add to a button group only one button from pair menu:button


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.