Get a j check box to call a method when selected

I've created a GUI with a couple of check boxes. I want one check box to call a method when selected and a different method when deselected and the same with the other check box but obviously with different methods. Had a look at the java documentation but couldn't work out. any ideas?
[295 byte] By [smithersinnita] at [2007-10-1 0:50:32]
# 1
Add an appropriate listener.The listener is called when the JCheckBox is selected/deselected
Peter-Lawreya at 2007-7-8 1:06:09 > top of Java-index,Security,Event Handling...
# 2
got the listener in there already but how do u get it to call the two different methods for the same button?
smithersinnita at 2007-7-8 1:06:09 > top of Java-index,Security,Event Handling...
# 3
not button i mean check box
smithersinnita at 2007-7-8 1:06:09 > top of Java-index,Security,Event Handling...
# 4
By default the same method is called with an event which tells you if the JCheckBox was selected or not.You can check e.getStateChange() == ItemEvent.SELECTED and call one method if true, and another if
Peter-Lawreya at 2007-7-8 1:06:09 > top of Java-index,Security,Event Handling...
# 5
sorted it. I tried these things out to start with but just noticed I didn't add the item listener to the component! doh! thanks for responding.
smithersinnita at 2007-7-8 1:06:09 > top of Java-index,Security,Event Handling...