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 / April 2005

Tip: Looking for answers? Try searching our database.

Difference between itemStateChanged and stateChanged for a JCheckBoxMenuItem

Thread view: 
Nomak - 28 Apr 2005 17:16 GMT
Hello,

which one is better to use for a JCheckBoxMenuItem:
- itemStateChanged
or
- stateChanged

?

any piece of advice is welcome

Thx
klynn47@comcast.net - 28 Apr 2005 17:31 GMT
What interface are you implementing?
John McGrath - 28 Apr 2005 22:56 GMT
> which one is better to use for a JCheckBoxMenuItem:
> - itemStateChanged
> or
> - stateChanged

That depends on what you want to do with it.

ChangeListener (stateChanged) is a very general interface which is use by
many different components.  ChangeEvents are usually fired when *any*
state changes.  A JCheckBoxMenuItem will fire a change event when the menu
item is armed, highlighted, selected, etc, and you will normally receive
many ChangeEvents as the user interacts with the JCheckBoxMenuItem.  The
event will not tell you anything about what changed - you will need to
look at the event source and figure that out yourself.

ItemListener (itemStateChanged) is used for components that can be
selected or deselected, such as toggle buttons, checkboxes and radio
buttons.  You will receive a single ItemEvent each time the selection
changes and the event has a getStateChange() method that will tell you
whether it was a selection or deselection.

Signature

Regards,

John McGrath

Nomak - 29 Apr 2005 08:51 GMT
> > which one is better to use for a JCheckBoxMenuItem:
> > - itemStateChanged
[quoted text clipped - 16 lines]
> changes and the event has a getStateChange() method that will tell you
> whether it was a selection or deselection.

thx a lot


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.