This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes difference between ItemStateChanged and ActionPerformed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "difference between ItemStateChanged and ActionPerformed" Watch "difference between ItemStateChanged and ActionPerformed" New topic
Author

difference between ItemStateChanged and ActionPerformed

Swela Jathar
Greenhorn

Joined: Aug 19, 2011
Posts: 22
Hi...
what is the actual difference between ItemStateChanged and ActionPerformed in case of combobox??
Should I ever use one instead of the other?
Thanks.....
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4761
    
    6

Have you gone through the tutorial on How to Use Combo Boxes, linked from the API for JComboBox?

The best way to understand the difference is to write code that adds both listeners to a combo box which print the method name and details of the event parameter. Then play with the combo and observe what events are fired, and when.

Also, the methods are itemStateChanged and actionPerformed. Java is case sensitive.


luck, db
There are no new questions, but there may be new answers.
 
rocket mass heater kickstarter
 
subject: difference between ItemStateChanged and ActionPerformed