Listener API Table

 <  Day Day Up  >  

In Table 2, the first column gives the name of the listener interface. The second column names the corresponding adapter class, if any. For a discussion of how to use adapters, see Event Adapters (page 114). The third column lists the methods that the listener interface contains and shows the type of the event object passed into the method. Typically, the listener, the adapter, and the event type have the same name prefix, but this is not always the case.

Table 2. Listener API Summary

Listener Interface

Adapter Class

Listener Methods

ActionListener

none

actionPerformed(ActionEvent)

AncestorListener

none

 ancestorAdded(AncestorEvent) ancestorMoved(AncestorEvent) ancestorRemoved(AncestorEvent) 

CaretListener

none

caretUpdate(CaretEvent)

CellEditorListener

none

 editingStopped(ChangeEvent) editingCanceled(ChangeEvent) 

ChangeListener

none

stateChanged(ChangeEvent)

ComponentListener

ComponentAdapter

 componentHidden(ComponentEvent) componentMoved(ComponentEvent) componentResized(ComponentEvent) componentShown(ComponentEvent) 

ContainerListener

ContainerAdapter

 componentAdded(ContainerEvent) componentRemoved(ContainerEvent) 

DocumentListener

none

 changedUpdate(DocumentEvent) insertUpdate(DocumentEvent) removeUpdate(DocumentEvent) 

ExceptionListener ( introduced in 1.4 )

none

exceptionThrown(Exception)

FocusListener

FocusAdapter

 focusGained(FocusEvent) focusLost(FocusEvent) 

HierarchyBoundsListener ( introduced in 1.3 )

HierarchyBoundsAdapter

 ancestorMoved(HierarchyEvent) ancestorResized(HierarchyEvent) 

HierarchyListener ( introduced in 1.3 )

none

hierarchyChanged(HierarchyEvent)

HyperlinkListener

none

hyperlinkUpdate(HyperlinkEvent)

InputMethodListener

none

 caretPositionChanged(InputMethodEvent) inputMethodTextChanged(InputMethodEvent) 

InternalFrameListener

InternalFrameAdapter

 internalFrameActivated(InternalFrameEvent) internalFrameClosed(InternalFrameEvent) internalFrameClosing(InternalFrameEvent) internalFrameDeactivated(              InternalFrameEvent) internalFrameDeiconified(              InternalFrameEvent) internalFrameIconified(InternalFrameEvent) internalFrameOpened(InternalFrameEvent) 

ItemListener

none

itemStateChanged(ItemEvent)

KeyListener

KeyAdapter

 keyPressed(KeyEvent) keyReleased(KeyEvent) keyTyped(KeyEvent) 

ListDataListener

none

 contentsChanged(ListDataEvent) intervalAdded(ListDataEvent) intervalRemoved(ListDataEvent) 

ListSelectionListener

none

valueChanged(ListSelectionEvent)

MenuDragMouseListener

none

 menuDragMouseDragged(MenuDragMouseEvent) menuDragMouseEntered(MenuDragMouseEvent) menuDragMouseExited(MenuDragMouseEvent) menuDragMouseReleased(MenuDragMouseEvent) 

MenuKeyListener

none

 menuKeyPressed(MenuKeyEvent) menuKeyReleased(MenuKeyEvent) menuKeyTyped(MenuKeyEvent) 

MenuListener

none

 menuCanceled(MenuEvent) menuDeselected(MenuEvent) menuSelected(MenuEvent) 

MouseInputListener (extends MouseListener and MouseMotionListener )

MouseInputAdapter

 mouseClicked(MouseEvent) mouseEntered(MouseEvent) mouseExited(MouseEvent) mousePressed(MouseEvent) mouseReleased(MouseEvent) mouseDragged(MouseEvent) mouseMoved(MouseEvent) 

MouseListener

MouseAdapter , MouseInputAdapter

 mouseClicked(MouseEvent) mouseEntered(MouseEvent) mouseExited(MouseEvent) mousePressed(MouseEvent) mouseReleased(MouseEvent) 

MouseMotionListener

MouseMotionAdapter , MouseInputAdapter

 mouseDragged(MouseEvent) mouseMoved(MouseEvent) 

MouseWheelListener ( introduced in 1.4 )

none

mouseWheelMoved(MouseWheelEvent)

PopupMenuListener

none

 popupMenuCanceled(PopupMenuEvent) popupMenuWillBecomeInvisible(PopupMenuEvent) popupMenuWillBecomeVisible(PopupMenuEvent) 

PropertyChangeListener

none

propertyChange(PropertyChangeEvent)

TableColumnModelListener

none

 columnAdded(TableColumnModelEvent) columnMoved(TableColumnModelEvent) columnRemoved(TableColumnModelEvent) columnMarginChanged(ChangeEvent) columnSelectionChanged(ListSelectionEvent) 

TableModelListener

none

tableChanged(TableModelEvent)

TreeExpansionListener

none

 treeCollapsed(TreeExpansionEvent) treeExpanded(TreeExpansionEvent) 

TreeModelListener

none

 treeNodesChanged(TreeModelEvent) treeNodesInserted(TreeModelEvent) treeNodesRemoved(TreeModelEvent) treeStructureChanged(TreeModelEvent) 

TreeSelectionListener

none

valueChanged(TreeSelectionEvent)

TreeWillExpandListener

none

 treeWillCollapse(TreeExpansionEvent) treeWillExpand(TreeExpansionEvent) 

UndoableEditListener

none

undoableEditHappened(UndoableEditEvent)

VetoableChangeListener

none

vetoableChange(PropertyChangeEvent)

WindowFocusListener ( introduced in 1.4 )

WindowAdapter

 windowGainedFocus(WindowEvent) windowLostFocus(WindowEvent) 

WindowListener

WindowAdapter

 windowActivated(WindowEvent) windowClosed(WindowEvent) windowClosing(WindowEvent) windowDeactivated(WindowEvent) windowDeiconified(WindowEvent) windowIconified(WindowEvent) windowOpened(WindowEvent) 

WindowStateListener ( introduced in 1.4 )

WindowAdapter

windowStateChanged(WindowEvent)

 <  Day Day Up  >  


JFC Swing Tutorial, The. A Guide to Constructing GUIs
The JFC Swing Tutorial: A Guide to Constructing GUIs (2nd Edition)
ISBN: 0201914670
EAN: 2147483647
Year: 2004
Pages: 171

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net