Chapter 14. The java.awt.event PackageThe java.awt.event package defines classes and interfaces used for event handling in the AWT and Swing. The members of this package fall into three categories:
Figure 14-1 shows the class hierarchy of this package. The Swing user-interface components use some of these event classes and interfaces and also define others in the javax.swing.event package. The java.beans package also defines a few commonly used event classes and listener interfaces. Note that this package is part of the Java 1.1 event model. In Java 1.0, events were represented by the java.awt.Event class. See Chapter 2, "Swing and AWTArchitecture", for an introduction to events and event handling. Figure 14-1. The java.awt.event package
An object of this class represents a high-level action event generated by an AWT component. Instead of representing a direct user event, such as a mouse or keyboard event, ActionEvent represents some sort of action performed by the user on an AWT component. The getID() method returns the type of action that has occurred. For AWT-generated action events, this type is always ActionEvent.ACTION_PERFORMED; custom components can generate action events of other types. The getActionCommand() method returns a String that serves as a kind of name for the action that the event represents. The Button and MenuItem components have a setActionCommand() method that allows the programmer to specify an action command string to be included with any action events generated by those components. It is this value that is returned by the getActionCommand() method. When more than one Button or other component notifies the same ActionListener, you can use getActionCommand() to help determine the appropriate response to the event. This is generally a better technique than using the source object returned by getSource(). If no action command string is explicitly set, getActionCommand() returns the label of the Button or MenuItem. Internationalized programs should not rely on these labels being constant. getModifiers() returns a value that indicates the keyboard modifiers that were in effect when the action event was triggered. Use the various _MASK constants, along with the & operator, to decode this value.
Hierarchy: Object-->java.util.EventObject(Serializable)-->AWTEvent-->ActionEvent Passed To: Too many methods to list.
This interface defines the method that an object must implement to listen for action events on AWT components. When an ActionEvent occurs, an AWT component notifies its registered ActionListener objects by invoking their actionPerformed() methods.
Hierarchy: (ActionListener(java.util.EventListener)) Implementations: AWTEventMulticaster, java.awt.dnd.DropTarget.DropTargetAutoScroller, javax.swing.Action, javax.swing.DefaultCellEditor.EditorDelegate, javax.swing.JComboBox, javax.swing.ToolTipManager.insideTimerAction, javax.swing.ToolTipManager.outsideTimerAction, javax.swing.ToolTipManager.stillInsideTimerAction, javax.swing.text.html.FormView, javax.swing.tree.DefaultTreeCellEditor Passed To: Too many methods to list. Returned By: AWTEventMulticaster.{add(), remove()}, javax.swing.AbstractButton.createActionListener(), javax.swing.JComponent.getActionForKeyStroke() Type Of: javax.swing.AbstractButton.actionListener
An event of this type indicates that an adjustment has been made to an Adjustable object--usually, this means that the user has interacted with a Scrollbar component. The getValue() method returns the new value of the Adjustable object. This is usually the most important piece of information stored in the event. getAdjustable() returns the Adjustable object that was the source of the event. It is a convenient alternative to the inherited getSource() method. The getID() method returns the type of an AdjustmentEvent. The standard AWT components only generate adjustment events of the type AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED. There are several types of adjustments that can be made to an Adjustable object, however, and the getAdjustmentType() method returns one of five constants to indicate which type has occurred. UNIT_INCREMENT indicates that the Adjustable value has been incremented by one unit, as in a scroll-line-down operation. UNIT_DECREMENT indicates the opposite: scroll-line-up. BLOCK_INCREMENT and BLOCK_DECREMENT indicate that the Adjustable object has been incremented or decremented by multiple units, as in a scroll-page-down or scroll-page-up operation. Finally, the TRACK constant indicates that the Adjustable value has been set to an absolute value unrelated to its previous value, as when the user drags a scrollbar to a new position.
Hierarchy: Object-->java.util.EventObject(Serializable)-->AWTEvent-->AdjustmentEvent Passed To: AWTEventMulticaster.adjustmentValueChanged(), Scrollbar.processAdjustmentEvent(), AdjustmentListener.adjustmentValueChanged()
This interface defines the method that an object must implement to listen for adjustment events on AWT components. When an AdjustmentEvent occurs, an AWT component notifies its registered AdjustmentListener objects by invoking their adjustmentValueChanged() methods.
Hierarchy: (AdjustmentListener(java.util.EventListener)) Implementations: AWTEventMulticaster Passed To: Adjustable.{addAdjustmentListener(), removeAdjustmentListener()}, AWTEventMulticaster.{add(), remove()}, Scrollbar.{addAdjustmentListener(), removeAdjustmentListener()}, javax.swing.JScrollBar.{addAdjustmentListener(), removeAdjustmentListener()} Returned By: AWTEventMulticaster.{add(), remove()}
This interface is implemented by objects, such as GUI macro recorders, that want to be notified of all AWT events that occur on Component and MenuComponent objects throughout the system. Register an AWTEventListener with the addAWTEventListener() method of Toolkit.
Hierarchy: (AWTEventListener(java.util.EventListener)) Passed To: Toolkit.{addAWTEventListener(), removeAWTEventListener()}
This class is a trivial implementation of ComponentListener; it provides empty bodies for each of the methods of that interface. When you are not interested in all of these methods, it is often easier to subclass ComponentAdapter than it is to implement ComponentListener from scratch.
Hierarchy: Object-->ComponentAdapter(ComponentListener(java.util.EventListener)) Subclasses: javax.swing.JViewport.ViewListener
An event of this type serves as notification that the source Component has been moved, resized, shown, or hidden. Note that this event is a notification only: the AWT handles these Component operations internally, and the recipient of the event need take no action itself. getComponent() returns the component that was moved, resized, shown, or hidden. It is simply a convenient alternative to getSource(). getID() returns one of four COMPONENT_ constants to indicate what operation was performed on the Component.
Hierarchy: Object-->java.util.EventObject(Serializable)-->AWTEvent-->ComponentEvent Subclasses: ContainerEvent, FocusEvent, InputEvent, PaintEvent, WindowEvent Passed To: AWTEventMulticaster.{componentHidden(), componentMoved(), componentResized(), componentShown()}, Component.processComponentEvent(), ComponentAdapter.{componentHidden(), componentMoved(), componentResized(), componentShown()}, ComponentListener.{componentHidden(), componentMoved(), componentResized(), componentShown()}, javax.swing.JViewport.ViewListener.componentResized()
This interface defines the methods that an object must implement to listen for component events on AWT components. When a ComponentEvent occurs, an AWT component notifies its registered ComponentListener objects by invoking one of their methods. An easy way to implement this interface is by subclassing the ComponentAdapter class.
Hierarchy: (ComponentListener(java.util.EventListener)) Implementations: AWTEventMulticaster, ComponentAdapter Passed To: AWTEventMulticaster.{add(), remove()}, Component.{addComponentListener(), removeComponentListener()} Returned By: AWTEventMulticaster.{add(), remove()}
This class is a trivial implementation of ContainerListener; it provides empty bodies for each of the methods of that interface. When you are not interested in all of these methods, it is often easier to subclass ContainerAdapter than it is to implement ContainerListener from scratch.
Hierarchy: Object-->ContainerAdapter(ContainerListener(java.util.EventListener))
An event of this type serves as notification that the source Container has had a child added to it or removed from it. Note that this event is a notification only; the AWT adds or removes the child internally, and the recipient of this event need take no action itself. getChild() returns the child Component that was added or removed, and getContainer() returns the Container to which it was added or from which it was removed. getContainer() is simply a convenient alternative to getSource(). getID() returns the constant COMPONENT_ADDED or COMPONENT_REMOVED to indicate whether the specified child was added or removed.
Hierarchy: Object-->java.util.EventObject(Serializable)-->AWTEvent-->ComponentEvent-->ContainerEvent Passed To: AWTEventMulticaster.{componentAdded(), componentRemoved()}, Container.processContainerEvent(), ContainerAdapter.{componentAdded(), componentRemoved()}, ContainerListener.{componentAdded(), componentRemoved()}, javax.swing.JComponent.AccessibleJComponent.AccessibleContainerHandler.{componentAdded(), componentRemoved()}
This interface defines the methods that an object must implement to listen for container events on AWT components. When a ContainerEvent occurs, an AWT component notifies its registered ContainerListener objects by invoking one of their methods. An easy way to implement this interface is by subclassing the ContainerAdapter class.
Hierarchy: (ContainerListener(java.util.EventListener)) Implementations: AWTEventMulticaster, ContainerAdapter, javax.swing.JComponent.AccessibleJComponent.AccessibleContainerHandler Passed To: AWTEventMulticaster.{add(), remove()}, Container.{addContainerListener(), removeContainerListener()} Returned By: AWTEventMulticaster.{add(), remove()} Type Of: javax.swing.JComponent.AccessibleJComponent.accessibleContainerHandler
This class is a trivial implementation of FocusListener; it provides empty bodies for each of the methods of that interface. When you are not interested in all of these methods, it is often easier to subclass FocusAdapter than it is to implement FocusListener from scratch.
Hierarchy: Object-->FocusAdapter(FocusListener(java.util.EventListener))
An event of this type indicates that a Component has gained or lost focus on a temporary or permanent basis. Use the inherited getComponent() method to determine which component has gained or lost focus. Use getID() to determine the type of focus event; it returns FOCUS_GAINED or FOCUS_LOST. When focus is lost, you can call isTemporary() to determine whether it is a temporary loss of focus. Temporary focus loss occurs when the window that contains the component loses focus, for example, or when focus is temporarily diverted to a popup menu or a scrollbar. Similarly, you can also use isTemporary() to determine whether focus is being granted to a component on a temporary basis.
Hierarchy: Object-->java.util.EventObject(Serializable)-->AWTEvent-->ComponentEvent-->FocusEvent Passed To: AWTEventMulticaster.{focusGained(), focusLost()}, Component.processFocusEvent(), FocusAdapter.{focusGained(), focusLost()}, FocusListener.{focusGained(), focusLost()}, javax.swing.JComponent.processFocusEvent(), javax.swing.text.DefaultCaret.{focusGained(), focusLost()}
This interface defines the methods that an object must implement to listen for focus events on AWT components. When a FocusEvent occurs, an AWT component notifies its registered FocusListener objects by invoking one of their methods. An easy way to implement this interface is by subclassing the FocusAdapter class.
Hierarchy: (FocusListener(java.util.EventListener)) Implementations: AWTEventMulticaster, FocusAdapter, javax.swing.text.DefaultCaret Passed To: Too many methods to list. Returned By: AWTEventMulticaster.{add(), remove()}
This abstract class serves as the superclass for the raw user input event types MouseEvent and KeyEvent. Use the inherited getComponent() method to determine in which component the event occurred. Use getWhen() to obtain a timestamp for the event. Use getModifiers() to determine which keyboard modifier keys or mouse buttons were down when the event occurred. You can decode the getModifiers() return value using the various _MASK constants defined by this class. The class also defines four convenience methods for determining the state of keyboard modifiers. As of Java 1.1, input events are delivered to the appropriate listener objects before they are delivered to the AWT components themselves. If a listener calls the consume() method of the event, the event is not passed on to the component. For example, if a listener registered on a Button consumes a mouse click, it prevents the button itself from responding to that event. You can use isConsumed() to test whether some other listener object has already consumed the event.
Hierarchy: Object-->java.util.EventObject(Serializable)-->AWTEvent-->ComponentEvent-->InputEvent Subclasses: KeyEvent, MouseEvent Passed To: java.awt.dnd.DragGestureRecognizer.appendEvent() Returned By: java.awt.dnd.DragGestureEvent.getTriggerEvent(), java.awt.dnd.DragGestureRecognizer.getTriggerEvent()
Events of this type are sent from an input method to the text input component or text composition window that is using the services of the input method. An InputMethodEvent is generated each time the user makes an edit to the text that is being composed. Input method details are usually hidden by text input components. Application-level code should never have to use this class. The getText() method returns a java.text.AttributedCharacterIterator that contains the current input method text. getCommittedCharacterCount() specifies how many characters of that text have been fully composed and committed, so that they are ready to be integrated into the text input component. The input method does not send these committed characters again. Any characters returned by the iterator beyond the specified number of committed characters are characters that are still undergoing composition and are not ready to be integrated into the text input component. These characters may be repeated in future InputMethodEvent objects, as the user continues to edit them.
Hierarchy: Object-->java.util.EventObject(Serializable)-->AWTEvent-->InputMethodEvent Passed To: AWTEventMulticaster.{caretPositionChanged(), inputMethodTextChanged()}, Component.processInputMethodEvent(), InputMethodListener.{caretPositionChanged(), inputMethodTextChanged()}, javax.swing.text.JTextComponent.processInputMethodEvent()
This interface defines the methods that a text input component must define in order to receive notifications from an input method. caretPositionChanged() is invoked when the user has moved the editing cursor. inputMethodTextChanged() is invoked when the user has edited text being composed by the input method. Input method details are usually hidden by text input components. Application-level code should never have to use or implement this interface.
Hierarchy: (InputMethodListener(java.util.EventListener)) Implementations: AWTEventMulticaster Passed To: AWTEventMulticaster.{add(), remove()}, Component.{addInputMethodListener(), removeInputMethodListener()}, javax.swing.text.JTextComponent.addInputMethodListener() Returned By: AWTEventMulticaster.{add(), remove()}
An event of this type is not generated by an asynchronous external event, such as user input. Instead, an InvocationEvent is placed on the event queue by the invokeLater() and invokeAndWait() methods of EventQueue. InvocationEvent implements java.awt.ActiveEvent, which means that it is an event that knows how to dispatch itself, with its own dispatch() method. When an InvocationEvent reaches the front of the event queue, its dispatch() method is called, and this invokes the run() method of the Runnable object specified when the InvocationEvent was created. This technique provides a simple method for running arbitrary code from the event dispatch thread. Applications need not be concerned with these details; they can simply use the invokeLater() and invokeAndWait() methods of EventQueue.
Hierarchy: Object-->java.util.EventObject(Serializable)-->AWTEvent-->InvocationEvent(ActiveEvent)
An event of this type indicates that an item within an ItemSelectable component has had its selection state changed. getItemSelectable() is a convenient alternative to getSource() that returns the ItemSelectable object that originated the event. getItem() returns an object that represents the item that was selected or deselected. getID() returns the type of the ItemEvent. The standard AWT components always generate item events of type ITEM_STATE_CHANGED. The getStateChange() method returns the new selection state of the item: it returns one of the constants SELECTED or DESELECTED. (This value can be misleading for Checkbox components that are part of a CheckboxGroup. If the user attempts to deselect a selected component, a DESELECTED event is delivered, but the CheckboxGroup immediately reselects the component to enforce its requirement that at least one Checkbox be selected at all times.)
Hierarchy: Object-->java.util.EventObject(Serializable)-->AWTEvent-->ItemEvent Passed To: AWTEventMulticaster.itemStateChanged(), Checkbox.processItemEvent(), CheckboxMenuItem.processItemEvent(), Choice.processItemEvent(), java.awt.List.processItemEvent(), ItemListener.itemStateChanged(), javax.swing.AbstractButton.fireItemStateChanged(), javax.swing.DefaultButtonModel.fireItemStateChanged(), javax.swing.DefaultCellEditor.EditorDelegate.itemStateChanged(), javax.swing.JComboBox.fireItemStateChanged(), javax.swing.JToggleButton.AccessibleJToggleButton.itemStateChanged()
This interface defines the method that an object must implement to listen for item events on AWT components. When an ItemEvent occurs, an AWT component notifies its registered ItemListener objects by invoking their itemStateChanged() methods.
Hierarchy: (ItemListener(java.util.EventListener)) Implementations: AWTEventMulticaster, javax.swing.DefaultCellEditor.EditorDelegate, javax.swing.JToggleButton.AccessibleJToggleButton Passed To: Too many methods to list. Returned By: AWTEventMulticaster.{add(), remove()}, javax.swing.AbstractButton.createItemListener() Type Of: javax.swing.AbstractButton.itemListener
This class is a trivial implementation of KeyListener; it provides empty bodies for each of the methods of that interface. When you are not interested in all of these methods, it is often easier to subclass KeyAdapter than it is to implement KeyListener from scratch.
Hierarchy: Object-->KeyAdapter(KeyListener(java.util.EventListener))
An event of this type indicates that the user has pressed or released a key on the keyboard. Call getID() to determine the particular type of key event that has occurred. The constant KEY_PRESSED indicates that a key has been pressed, while the constant KEY_RELEASED indicates that a key has been released. Not all keystrokes actually correspond to or generate Unicode characters. Modifier keys and function keys, for example, do not correspond to characters. Furthermore, for internationalized input, multiple keystrokes are sometimes required to generate a single character of input. Therefore, getID() returns a third constant, KEY_TYPED, to indicate a KeyEvent that actually contains a character value. For KEY_PRESSED and KEY_RELEASED key events, use getKeyCode() to obtain the virtual keycode of the key that was pressed or released. KeyEvent defines a number of VK_ constants that represent these virtual keys. Note that not all keys on all keyboards have corresponding constants in the KeyEvent class, and not all keyboards can generate all of the virtual keycodes defined by this class. As of Java 1.1, the VK_ constants for letter keys, number keys, and some other keys have the same values as the ASCII encodings of the letters and numbers. You should not rely on this to always be the case, however. If the key that was pressed or released corresponds directly to a Unicode character, you can obtain that character by calling getKeyChar(). If there is not a corresponding Unicode character, this method returns the constant CHAR_UNDEFINED. The isActionKey() method returns true if the key that was pressed or released does not have a corresponding character. For KEY_TYPED key events, use getKeyChar() to return the Unicode character that was typed. If you call getKeyCode() for this type of key event, it returns VK_UNDEFINED. See InputEvent for information on inherited methods you can use to obtain the keyboard modifiers that were down during the event and other important methods. Use getComponent(), inherited from ComponentEvent, to determine over what component the event occurred. The static method getKeyText() returns a (possibly localized) textual name for a given keycode. The static method getKeyModifiersText() returns a (possibly localized) textual description for a set of modifiers. KeyEvent has methods that allow you to change the keycode, key character, or modifiers of an event. These methods, along with the consume() method, allow a KeyListener to perform filtering of key events before they are passed to the underlying AWT component.
Hierarchy: Object-->java.util.EventObject(Serializable)-->AWTEvent-->ComponentEvent-->InputEvent-->KeyEvent Subclasses: javax.swing.event.MenuKeyEvent Passed To: Too many methods to list.
This interface defines the methods that an object must implement to listen for key events on AWT components. When a KeyEvent occurs, an AWT component notifies its registered KeyListener objects by invoking one of their methods. An easy way to implement this interface is by subclassing the KeyAdapter class.
Hierarchy: (KeyListener(java.util.EventListener)) Implementations: AWTEventMulticaster, KeyAdapter Passed To: AWTEventMulticaster.{add(), remove()}, Component.{addKeyListener(), removeKeyListener()} Returned By: AWTEventMulticaster.{add(), remove()}
This class is a trivial implementation of MouseListener; it provides empty bodies for each of the methods of that interface. When you are not interested in all of these methods, it is often easier to subclass MouseAdapter than it is to implement MouseListener from scratch.
Hierarchy: Object-->MouseAdapter(MouseListener(java.util.EventListener)) Subclasses: javax.swing.ToolTipManager, javax.swing.text.html.FormView.MouseEventListener, javax.swing.text.html.HTMLEditorKit.LinkController
An event of this type indicates that the user has moved the mouse or pressed one of the mouse buttons. Call getID() to determine the specific type of mouse event that has occurred. This method returns one of the following seven constants, which corresponds to a method in either the MouseListener or MouseMotionListener interface:
Use getX() and getY() or getPoint() to obtain the coordinates of the mouse event. Use translatePoint() to modify these coordinates by a specified amount. Use getModifiers() and other methods and constants inherited from InputEvent to determine the mouse button or keyboard modifiers that were down when the event occurred. See InputEvent for details. Note that mouse button modifiers are not reported for MOUSE_RELEASED events, since, technically, the mouse button in question is no longer pressed. Use getComponent(), inherited from ComponentEvent, to determine over which component the event occurred. For mouse events of type MOUSE_CLICKED, MOUSE_PRESSED, or MOUSE_RELEASED, call getClickCount() to determine how many consecutive clicks have occurred. If you are using popup menus, use isPopupTrigger() to test whether the current event represents the standard platform-dependent popup menu trigger event.
Hierarchy: Object-->java.util.EventObject(Serializable)-->AWTEvent-->ComponentEvent-->InputEvent-->MouseEvent Subclasses: javax.swing.event.MenuDragMouseEvent Passed To: Too many methods to list. Returned By: javax.swing.SwingUtilities.convertMouseEvent()
This interface defines the methods that an object must implement to listen for mouse events on AWT components. When a MouseEvent occurs, an AWT component notifies its registered MouseListener objects (or MouseMotionListener objects, if the event involves mouse motion) by invoking one of their methods. An easy way to implement this interface is by subclassing the MouseAdapter class.
Hierarchy: (MouseListener(java.util.EventListener)) Implementations: AWTEventMulticaster, java.awt.dnd.MouseDragGestureRecognizer, MouseAdapter, javax.swing.event.MouseInputListener, javax.swing.text.DefaultCaret Passed To: AWTEventMulticaster.{add(), remove()}, Component.{addMouseListener(), removeMouseListener()} Returned By: AWTEventMulticaster.{add(), remove()}
This class is a trivial implementation of MouseMotionListener; it provides empty bodies for each of the methods of that interface. When you are not interested in all of these methods, it is often easier to subclass MouseMotionAdapter than it is to implement MouseMotionListener from scratch.
Hierarchy: Object-->MouseMotionAdapter(MouseMotionListener(java.util.EventListener))
This interface defines the methods that an object must implement to listen for mouse motion events on AWT components. When a MouseEvent involving a mouse drag or mouse motion with no buttons down occurs, an AWT component notifies its registered MouseMotionListener objects by invoking one of their methods. An easy way to implement this is by subclassing the MouseMotionAdapter class.
Hierarchy: (MouseMotionListener(java.util.EventListener)) Implementations: AWTEventMulticaster, java.awt.dnd.MouseDragGestureRecognizer, MouseMotionAdapter, javax.swing.ToolTipManager, javax.swing.event.MouseInputListener, javax.swing.text.DefaultCaret Passed To: AWTEventMulticaster.{add(), remove()}, Component.{addMouseMotionListener(), removeMouseMotionListener()} Returned By: AWTEventMulticaster.{add(), remove()}
An event of this type indicates that a component should have its update() method invoked. (The update() method typically, by default, invokes the paint() method.) PaintEvent differs from the other event types in java.awt.event in that it does not have a corresponding EventListener interface. PaintEvent is essentially for internal use by the AWT redisplay framework, so your programs should not try to handle it the way they handle other events. Instead, applets and custom components should simply override their paint() and/or update() methods to redraw themselves appropriately. AWT automatically invokes update() (which typically invokes paint()) when a PaintEvent arrives. Although you do not typically use PaintEvent, redraw events are implemented through this class for simplicity, so that they are on equal footing with other event types and so that advanced programs can manipulate them through the EventQueue.
Hierarchy: Object-->java.util.EventObject(Serializable)-->AWTEvent-->ComponentEvent-->PaintEvent
An event of this type indicates that the user has edited the text value that appears in a TextField, TextArea, or other TextComponent. This event is triggered by any change to the displayed text. Note that this is not the same as the ActionEvent sent by the TextField object when the user edits the text and strikes the Return key. Use the inherited getSource() to determine the object that was the source of this event. You have to cast that object to its TextComponent type. Call getID() to determine the type of a TextEvent. The standard AWT components always generate text events of type TEXT_VALUE_CHANGED.
Hierarchy: Object-->java.util.EventObject(Serializable)-->AWTEvent-->TextEvent Passed To: AWTEventMulticaster.textValueChanged(), TextComponent.processTextEvent(), TextListener.textValueChanged()
This interface defines the method that an object must implement to listen for text events on AWT components. When a TextEvent occurs, an AWT component notifies its registered TextListener objects by invoking their textValueChanged() methods.
Hierarchy: (TextListener(java.util.EventListener)) Implementations: AWTEventMulticaster Passed To: AWTEventMulticaster.{add(), remove()}, TextComponent.{addTextListener(), removeTextListener()} Returned By: AWTEventMulticaster.{add(), remove()} Type Of: TextComponent.textListener
This class is a trivial implementation of WindowListener; it provides empty bodies for each of the methods of that interface. When you are not interested in all of these methods, it is often easier to subclass WindowAdapter than it is to implement WindowListener from scratch.
Hierarchy: Object-->WindowAdapter(WindowListener(java.util.EventListener)) Subclasses: javax.swing.JMenu.WinListener
An event of this type indicates that an important action has occurred for a Window object. Call getWindow() to determine the Window object that is the source of this event. Call getID() to determine the specific type of event that has occurred. Each of the following seven constants corresponds to one of the methods of the WindowListener interface:
Hierarchy: Object-->java.util.EventObject(Serializable)-->AWTEvent-->ComponentEvent-->WindowEvent Passed To: Too many methods to list.
This interface defines the methods that an object must implement to listen for window events on AWT components. When a WindowEvent occurs, an AWT component notifies its registered WindowListener objects by invoking one of their methods. An easy way to implement this interface is by subclassing the WindowAdapter class.
Hierarchy: (WindowListener(java.util.EventListener)) Implementations: AWTEventMulticaster, WindowAdapter Passed To: AWTEventMulticaster.{add(), remove()}, Window.{addWindowListener(), removeWindowListener()} Returned By: AWTEventMulticaster.{add(), remove()} Copyright © 2001 O'Reilly & Associates. All rights reserved. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|