The only start-to-finish guide to Java event handling.
- Unlocks the power of Java event handling to enhance GUI development
- Teaches basic skills and advanced event programming techniques
- Provides complete technical references to all Java events
- Stand-alone examples demonstrate the potential of Java events
- Covers event classes, interfaces, the Java event model, and more!
Efficient event handling is key to creating powerful, GUI-based Java
software. Java Event Handling is the first Java book to focus entirely on
event handling, from the absolute basics to state-of-the-art techniques. Expert
Java developer Grant Palmer presents an in-depth introduction to the Java event
model, showing how event handling has evolved to provide greater power and
control, and demonstrating how to take full advantage of it. Coverage
includes:
- Local and distributed events: differences, similarities, and practical
- techniques
- Detailed technical reference to all Java events: event classes,
- listener interfaces, support classes, lifecycle methods, and more
- Advanced techniques: event listener manager classes, user-defined
- event classes, event listeners, and more
- Dozens of practical, easy-to-adapt code examples
Whatever your Java experience, Java Event Handling delivers the expert
insights and practical guidance you need to supercharge virtually any GUI-based
application.
Table of
Contents
Acknowledgments.
Introduction.
A Roadmap for this Book. A Note on the Code
Examples. What This Book is Not.
About the Author.
I. THE BASICS.
1. An Introduction to Java Events.
What Is an Event? Local Versus Distributed
Events. The Evolution of Java Event Handling. The Java Event Model. The Java 1.0
Event Model. The Java 1.1 Event Model.
2. The Java Event Life Cycle.
Event Life Cycle Methods. Basic Event Life Cycle
Methods from the Component Class. Event Processing Methods. Methods to Fire
Events. Deprecated Methods from the Component Class. Event Life Cycle Methods
Defined in the Component Subclasses.
3. Event Classes.
Event and Support Class Hierarchy. Low-Level
Versus High-Level Event Types. A Description of the Event Classes in the J2SE.
The EventObject Class. The AWTEvent Class. Low-Level Event Classes Defined in
the java.awt.event Package. High-Level Event Classes Defined in the
java.awt.event Package. Special Event Classes Defined in the java.awt.event
Package. Low-Level Event Classes Defined in the javax.swing.event Package.
High-Level Event Classes Defined in the javax.swing.event Package. High-Level
Event Interfaces Defined in the javax.swing.event Package. Event Support Classes
Defined in the javax.swing.event Package. Event and Support Classes Defined in
the java.beans Package. Event Classes Defined in the javax.swing.text.html
Package. Event Support Classes Defined in the javax.swing.undo Package. Other
Event Classes Defined in the J2SE. User-Generated Events. User-Defined Events.
4. Event Listeners.
A Brief Review of Interfaces. Event Listener
Interfaces in the J2SE. EventListener Interface. Listener Interfaces Contained
in the java.awt.event Package. Listener Interfaces Contained in the
javax.swing.event Package. Listener Interfaces Contained in the java.beans
Package. Other Listener Interfaces Defined in the J2SE. Event Listener Objects.
Creating an Event Listener. Method 1: Have a GUI Component Serve as the Event
Listener. Method 2: Implement the Event Listener as a Separate Class. Method 3:
Implement the Event Listener as an Inner Class. Method 4: Implement the Event
Listener as an Anonymous Inner Class. Listener Adapter Classes. Listener Adapter
Classes Contained in the java.awt.event Package. Listener Adapter Classes
Contained in the javax.swing.event Package. User-Defined Event Listener
Interfaces. Connecting an Event Source to an Event Listener. Disconnecting an
Event Source from an Event Listener. The getListeners() Method. Event Listener
Manager Classes. AWTEventMulticaster Class. EventListenerList Class.
5. Event Handling Odds and Ends.
Determining the Event Source. Consuming Events.
Event Consumption Methods. The Event Queue. EventQueue Class. The
Event-Dispatching Thread. Running Code in the Event-Dispatching Thread.
II. A JAVA EVENT REFERENCE.
6. Event Classes and Interfaces.
ActionEvent Class. ActiveEvent Interface.
AdjustmentEvent Class. AncestorEvent Class. AWTEvent Class. CaretEvent Class.
ChangeEvent Class. ComponentEvent Class. ContainerEvent Class. DocumentEvent
Interface. DocumentEvent.ElementChange Interface. DocumentEvent.EventType Class.
EventObject Class. FocusEvent Class. HierarchyEvent Class.
HTMLFrameHyperlinkEvent Class. HyperlinkEvent Class. HyperlinkEvent.EventType
Class. InputEvent Class. InputMethodEvent Class. InternalFrameEvent Class.
InvocationEvent Class. ItemEvent Class. KeyEvent Class. ListDataEvent Class.
ListSelectionEvent Class. MenuDragMouseEvent Class. MenuEvent Class.
MenuKeyEvent Class. MouseEvent Class. PaintEvent Class. PopupMenuEvent Class.
PropertyChangeEvent Class. TableColumnModelEvent Class. TableModelEvent Class.
TextEvent Class. TreeExpansionEvent Class. TreeModelEvent Class.
TreeSelectionEvent Class. UndoableEditEvent Class. WindowEvent Class. Other
Event Classes in the J2SE.
7. Event Support Classes.
PropertyChangeSupport Class.
SwingPropertyChangeSupport Class. UndoableEditSupport Class.
VetoableChangeSupport Class.
8. Event Listener Interfaces.
ActionListener Interface. AdjustmentListener
Interface. AncestorListener Interface. AWTEventListener Interface. CaretListener
Interface. CellEditorListener Interface. ChangeListener Interface.
ComponentListener Interface. ContainerListener Interface. DocumentListener
Interface. EventListener Interface. FocusListener Interface.
HierarchyBoundsListener Interface. HierarchyListener Interface.
HyperlinkListener Interface. InputMethodListener Interface.
InternalFrameListener Interface. ItemListener Interface. KeyListener Interface.
ListDataListener Interface. ListSelectionListener Interface.
MenuDragMouseListener Interface. MenuKeyListener Interface. MenuListener
Interface. MouseInputListener Interface. MouseListener Interface.
MouseMotionListener Interface. PopupMenuListener Interface.
PropertyChangeListener Interface. TableColumnModelListener Interface.
TableModelListener Interface. TextListener Interface. TreeExpansionListener
Interface. TreeModelListener Interface. TreeSelectionListener Interface.
TreeWillExpandListener Interface. UndoableEditListener Interface.
VetoableChangeListener Interface. WindowListener Interface. Other Listener
Interfaces in the J2SE.
9. Listener Adapter Classes.
ComponentAdapter Class. ContainerAdapter Class.
FocusAdapter Class. HierarchyBoundsAdapter Class. InternalFrameAdapter Class.
KeyAdapter Class. MouseAdapter Class. MouseInputAdapter Class.
MouseMotionAdapter Class. WindowAdapter Class.
10. Event Life Cycle Methods.
AbstractAction Class Methods. AbstractButton
Class Methods. AbstractCellEditor Class Methods. AbstractListModel Class
Methods. Button Class Methods. Checkbox Class Methods. CheckboxMenuItem Class
Methods. Choice Class Methods. Component Class Methods. Container Class Methods.
DefaultBoundedRangeModel Class Methods. DefaultButtonModel Class Methods.
DefaultListCellRenderer Class Methods. DefaultListSelectionModel Class Methods.
DefaultSingleSelectionModel Class Methods. JApplet Class Methods. JComboBox
Class Methods. JComponent Class Methods. JDialog Class Methods. JEditorPane
Class Methods. JFrame Class Methods. JInternalFrame Class Methods. JList Class
Methods. JMenu Class Methods. JMenuBar Class Methods. JMenuItem Class Methods.
JPopupMenu Class Methods. JProgressBar Class Methods. JScrollBar Class Methods.
JSlider Class Methods. JTabbedPane Class Methods. JTextArea Class Methods.
JTextField Class Methods. JTree Class Methods. JViewport Class Methods. List
Class Methods. MenuComponent Class Methods. MenuItem Class Methods.
PropertyChangeSupport Class Methods. Scrollbar Class Methods.
SwingPropertyChangeSupport Class Methods. TextComponent Class Methods. TextField
Class Methods. Timer Class Methods. VetoableChangeSupport Class Methods. Window
Class Methods.
III. ADVANCED TOPICS.
11. Event Listener Manager Classes.
AWTEventMulticaster Class. EventListenerList
Class.
12. User-Defined Event Classes and Event Listeners.
Creating a User-Defined EventListener. Creating
a User-Defined Event Class. Defining a Component that Supports a User-Defined
Event. Putting it All Together.
13. Putting It All Together.
Stagnation Point Heating Rate Program. A Java
Document Editor.
14. Distributed Events.
Distributed Event Model. Remote Event Classes.
RemoteEvent Class. RemoteDiscoveryEvent Class. RenewalFailureEvent Class.
ServiceEvent Class. Remote Event Listener Interfaces. Remote Interface.
RemoteEventListener Interface. Remote Event Listener Support Classes.
EventRegistration Class.
Appendix: Java GUI Components and the Events They Generate.
Index.