choice.addItemListener ( new ItemListener() { public void itemStateChanged ( ItemEvent event ) { Object object = event.getSource(); if ( object == choice ) { // true for item selected, false for deselected boolean selected = ( event.getStateChange() == ItemEvent.SELECTED ); selection = choice.getSelectedIndex(); } // end if } // end itemStateChanged } // end anonymous class ); // end addItemListener line