Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

difference between ItemStateChanged and ActionPerformed

 
Swela Jathar
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5148
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic