ItemEvent class in java.awt.event package: Integer constants, constructor, Methods

ItemEvent class in java.awt.event package is used for handling events created when a check box or a list item is clicked. It also handles events created when a choice selection is made or when a menu item which can be checked is selected or deselected.

Integer constants defined by ItemEvent class:

  • SELECTED: When an item is selected.
  • DESELECTED: When an item is de-selected.
  • ITEM_STATE_CHANGED: When state is changed for an item.

Constructor defined by ItemEvent class:

By using source, type of event, item, and state.

ItemEvent(ItemSelectable src, int type, Object entry, int state)

Methods defined by ItemEvent class:

getItem( ) method: It is used to get the reference to the item.


Object getItem( )

getItemSelectable( ) method: It is used to get the reference to ItemSelectable object.


ItemSelectable getItemSelectable( )

getStateChange( ) method: It returns change of state for an item.


int getStateChange( )

Leave a Reply