https://docs.google.com/spreadsheet/ccc?key=0Al4BjJlYg8vEdEdRVDBTVXV3c1R5UHNnUm5Zekl6cEE#gid=0https://docs.google.com/spreadsheet/ccc?key=0Al4BjJlYg8vEdEdRVDBTVXV3c1R5UHNnUm5Zekl6cEE#gid=0
Thursday, October 25, 2012
Monday, October 22, 2012
AWT notes
| Component | Event it generates |
|---|---|
| Button, TextField, List, Menu | ActionEvent |
| Frame | WindowEvent |
| Checkbox, Choice, List | ItemEvent |
| Scrollbar | AdjustmentEvent |
| Mouse (hardware) | MouseEvent |
| Keyboard (hardware) | KeyEvent |
| Listener Interface | Component |
|---|---|
| WindowListener | Frame |
| ActionListener | Button, TextField, List, Menu |
| ItemListener | Checkbox, Choice, List |
| AdjustmentListener | Scrollbar |
| MouseListener | Mouse (stable) |
| MouseMotionListener | Mouse (moving) |
| KeyListener | Keyboard |
example
public class ButtonDemo extends Frame implements ActionListener { public ButtonDemo() { Button btn = new Button("OK"); btn.addActionListener(this); add(btn); } public void actionPerformed(ActionEvent e) { String str = e.getActionCommand(); } } |
Subscribe to:
Comments (Atom)