AWT事件继承层次
EventObject类有一个子类AWTEvent,它是所有AWT事件类的父类。
Swing组件会生成更多其他事件对象,都直接拓展自EventObject而不是AWTEvent。
AWT将事件分为底层(low-level)事件和语义事件。
语义事件:表示用户的动作事件,例如点击按钮,调节滚动条。
底层事件:使得语义事件得以发生的事件,例如按下鼠标,移动鼠标等。
AWT事件类的继承关系图

java.awt.event包中最常用的语义事件类:
- ActionEvent(对应按钮点击,菜单选择,选择列表,文本域中按回车)
- AdjustmentEvent(用户调用滚动条)
- ItemEvent(用户从复选框或列表框中选择一项)
最常用的5个底层事件类是:
- KeyEvent(一个键按下或释放)
- MouseEvent(鼠标键按下、释放、移动、拖动)
- MouseWheelEvent(鼠标滚轮转动)
- FocusEvent(某个组件获得焦点或失去焦点)
- WindowEvent(窗口状态改变)
最重要的AWT监听器接口、事件和事件源
| 接口 | 方法 | 参数/访问方法 | 事件源 | 
| ActionListener | actionPerformed | ActionEvent 
 | AbstractButton JComboBox JTextField Timer | 
| AdjustmentListener | adjustmentValueChanged | AdjustmentEvent 
 | JScrollbar | 
| ItemListener | itemStateChanged | ItemEvent 
 | AbstractButton JComboxBox | 
| FocusListener | focusGained focusLost | FocusEvent 
 | Component | 
| KeyListener | keyPressed keyReleased keyTyped | KeyEvent 
 | Component | 
| MouseListener | mousePressed mouseReleased mouseEntered mouseExited mouseClicked | MouseEvent 
 | Component | 
| MouseMotionListener | mouseDragged mouseMoved | MouseEvent | Component | 
| MouseWheelListener | mouseWheelMoved | MouseWheelEvent 
 | Component | 
| WindowListener | windowClosing windowOpened windowIconfied windowDeiconified windowClosed windowActivated windowDeactivated | WindowEvent 
 | Window | 
| WindowFocusListener | windowGainedFocus windowLostFocus | WindowEvent 
 | Window | 
| WindowStateListener | windowStateChanged | WindowEvent 
 | Window |