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 / GUI / November 2005

Tip: Looking for answers? Try searching our database.

Q: Keeping JCheckBoxMenuItem and JToggleButton in sync through Action

Thread view: 
Casper Bang - 22 Nov 2005 16:53 GMT
I am using Action objects when building my JCheckBoxMenuItem and
JToggleButton items in the menubar and toolbar.

I assumed this would keep the two in sync just like happens with the
"enabled" property, but it seems I somehow have to manage the
checked/toggled state myself. Is this true? If so, how is it typically done?

Thanks in advance,
Casper
Vova Reznik - 22 Nov 2005 17:10 GMT
> I am using Action objects when building my JCheckBoxMenuItem and
> JToggleButton items in the menubar and toolbar.
[quoted text clipped - 3 lines]
> checked/toggled state myself. Is this true? If so, how is it typically
> done?

Actions has nothing to do with state (select/deselect).

To keep both components in sync you may try to share ButtonModel.

> Thanks in advance,
> Casper
jonck@vanderkogel.net - 22 Nov 2005 17:26 GMT
> I assumed this would keep the two in sync just like happens with
> the "enabled" property, but it seems I somehow have to manage
> the checked/toggled state myself. Is this true? If so, how is it
> typically done?

Your Action does not maintain the state of your checkbox, togglebutton,
etc... It merely dictates what should happen if the Action is
triggered. If you want the components to be notified of their
respective changes, you'll have to set them up as listeners of each
other.
Andrey Kuznetsov - 22 Nov 2005 18:13 GMT
>I am using Action objects when building my JCheckBoxMenuItem and
>JToggleButton items in the menubar and toolbar.
[quoted text clipped - 3 lines]
> checked/toggled state myself. Is this true? If so, how is it typically
> done?

see http://jgui.imagero.com/examples/SelectableAction/

Signature

Andrey Kuznetsov
http://uio.imagero.com Unified I/O for Java
http://reader.imagero.com Java image reader
http://jgui.imagero.com Java GUI components and utilities



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.