|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--CSE115.KeyInteractor
A class for listening to any type of key press. Based on
KeyInteractor by Matt Chotin.
Created: Fri Nov 23 16:08:31 2001| Field Summary | |
static int |
DOWN_ARROW
The code for the down arrow key. |
static int |
LEFT_ARROW
The code for the left arrow key. |
static int |
RIGHT_ARROW
The code for the right arrow key. |
static int |
UP_ARROW
The code for the up arrow key. |
| Constructor Summary | |
KeyInteractor(Panel panel,
char keyChar)
Create a KeyInteractor that will respond whenever the
key with the passed in character is pressed. |
|
KeyInteractor(Panel panel,
int keyCode)
Create a KeyInteractor that will respond whenever the
key is pressed. |
|
| Method Summary | |
void |
actionPerformed(ActionEvent e)
Normal users need not deal with this method! |
void |
disable()
Turn the KeyInteractor off so that it will not call keyPressed. |
void |
enable()
Turn the KeyInteractor on so that it will call keyPressed. |
boolean |
getEnabled()
Is this KeyInteractor enabled or disabled? |
abstract void |
keyPressed()
Subclasses should override to do something useful. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int UP_ARROW
public static final int DOWN_ARROW
public static final int LEFT_ARROW
public static final int RIGHT_ARROW
| Constructor Detail |
public KeyInteractor(Panel panel,
char keyChar)
KeyInteractor that will respond whenever the
key with the passed in character is pressed.
panel - the Panel that will "hear" the keypresses, a good choice is
the highest level panelkeyChar - the character on top of the key, pass ' ' for space, 'a'
for A without the Shift key and 'A' for A with the Shift key
public KeyInteractor(Panel panel,
int keyCode)
KeyInteractor that will respond whenever the
key is pressed.
panel - the Panel that will "hear" the keypresses, a good choice is
the highest level panelkeyCode - the code for the key being pressed.| Method Detail |
public void enable()
keyPressed.
disable,
getEnabledpublic void disable()
keyPressed.
enable,
getEnabledpublic boolean getEnabled()
KeyInteractor enabled or disabled?
true for enabled and false for disabledenable,
disablepublic abstract void keyPressed()
public void actionPerformed(ActionEvent e)
Called by the KeyStroke to indicate that it was pressed. Calls our
keyPressed method.
actionPerformed in interface ActionListenere - we do nothing with this parameter
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||