Source code: gui/AboutKeyListener.java
1 /**
2 * AboutKeyListener.java
3 *
4 * File creation date: 02.04.2001
5 * End of coding: 02.04.2001
6 * Last minor change: 02.04.2001
7 */
8
9 package gui;
10
11 import java.applet.*;
12 import java.awt.*;
13 import java.awt.event.*;
14
15 /**
16 * Key listener for button "Tegijad"
17 * @author Janno Liivak
18 * @version 1.0
19 */
20 public class AboutKeyListener implements KeyListener
21 {
22
23 /** button "Tegijad" */
24 Button aboutButton;
25 /** button "Puhasta" */
26 Button clearButton;
27
28 /**
29 * Constructs key listener for button "Tegijad"
30 * @param about button "Tegijad"
31 * @param clear button "Puhasta"
32 */
33 public AboutKeyListener(Button about, Button clear)
34 {
35 aboutButton = about;
36 clearButton = clear;
37 } // constructor
38
39 /**
40 * Invoked when a key has been pressed
41 * @param e An event which indicates that a keystroke occurred in a component
42 */
43 public void keyPressed(KeyEvent e)
44 {
45 if ((e.getKeyCode() == KeyEvent.VK_TAB) && (e.isShiftDown()))
46 {
47 clearButton.requestFocus();
48 }
49 else if (e.getKeyCode() == KeyEvent.VK_TAB)
50 {
51 aboutButton.transferFocus();
52 }
53 } // keyPressed
54
55 /**
56 * Invoked when a key has been typed
57 * @param e An event which indicates that a keystroke occurred in a component
58 */
59 public void keyTyped(KeyEvent e)
60 {
61 } // keyTyped
62
63 /**
64 * Invoked when a key has been released
65 * @param e An event which indicates that a keystroke occurred in a component
66 */
67 public void keyReleased(KeyEvent e)
68 {
69 } // keyReleased
70
71 } // class