Swing listeners
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Sunday, May 25, 2003 06:10 AM


I am using jBuilder8.I put a combobox in a frame.Its itemstatechanged events I wrote something.When the project runs,If i change the item in the combox , itemstatechanged functions runs twice.This sometimes occurs in buttons.Do you know Why

here is code

Re: Swing listeners

Posted By:   Bahman_Barzideh  
Posted On:   Sunday, May 25, 2003 08:40 AM

Change your print statement to include the value of the
getStateChange () on the ItemEvent you
get in your itemStateChanged () method. You will
see that the value on one of the two calls is ItemEvent.SELECTED and on the other it is ItemEvent.DESELECTED. This is because one entry is
being deselected while another is being selected. You can
use this criteria to ignore one or another of the two
sets.
About | Sitemap | Contact