Interface TGKeyHandler

All Known Implementing Classes:
TurtleGraphicsWindow

public interface TGKeyHandler

TGKeyHandler is an interface that a class implements when it would like to receive Java AWT key events from TGCanvas. The provided methods are an attempt to reduce the complexity of the, more general, KeyListener interface methods.

In the case of TG, TGDriver registers with TGCanvas, passing the events on to the current jLogo program, invoking specific user-defined procedures if they exist.

In the case of TurtleGraphicsWindow, the methods in this interface are stubs that should be overridden by child classes if they want to handle keyboard key events.


Field Summary
static int ALT
          [Alt] action key's numeric value for jLogo program.
static int CONTROL
          [Ctrl] action key's numeric value for jLogo program.
static int DOWN
          Deprecated.  
static int DOWN_ARROW
          [ v ] down-arrow action key's numeric value for jLogo program.
static int LEFT
          Deprecated.  
static int LEFT_ARROW
          [ <- ] left-arrow action key's numeric value for jLogo program.
static int RIGHT
          Deprecated.  
static int RIGHT_ARROW
          [ -> ] right-arrow action key's numeric value for jLogo program.
static int SHIFT
          [Shift] action key's numeric value for jLogo program.
static int UP
          Deprecated.  
static int UP_ARROW
          [ ^ ] up-arrow action key's numeric value for jLogo program.
 
Method Summary
 void tgKeyPressed(int keyNum)
          TGCanvas (a Component) passes on KeyListener.keyPressed() KeyEvents (simplified a bit) to classes that register with it and implement TGKeyHandler.
 void tgKeyReleased(int keyNum)
          TGCanvas (a Component) passes on KeyListener.keyReleased() KeyEvents (simplified a bit) to classes that register with it and implement TGKeyHandler.
 void tgKeyTyped(char keyChar)
          TGCanvas (a Component) passes on KeyListener.keyTyped() KeyEvents (simplified a bit) to classes that register with it and implement TGKeyHandler.
 

Field Detail

DOWN

static final int DOWN
Deprecated. 
Key number for down arrow in early versions of TG.

See Also:
Constant Field Values

LEFT

static final int LEFT
Deprecated. 
Key number for left arrow in early versions of TG.

See Also:
Constant Field Values

RIGHT

static final int RIGHT
Deprecated. 
Key number for right arrow in early versions of TG.

See Also:
Constant Field Values

UP

static final int UP
Deprecated. 
Key number for up arrow in early versions of TG.

See Also:
Constant Field Values

UP_ARROW

static final int UP_ARROW
[ ^ ] up-arrow action key's numeric value for jLogo program.

See Also:
Constant Field Values

DOWN_ARROW

static final int DOWN_ARROW
[ v ] down-arrow action key's numeric value for jLogo program.

See Also:
Constant Field Values

LEFT_ARROW

static final int LEFT_ARROW
[ <- ] left-arrow action key's numeric value for jLogo program.

See Also:
Constant Field Values

RIGHT_ARROW

static final int RIGHT_ARROW
[ -> ] right-arrow action key's numeric value for jLogo program.

See Also:
Constant Field Values

ALT

static final int ALT
[Alt] action key's numeric value for jLogo program.

See Also:
Constant Field Values

CONTROL

static final int CONTROL
[Ctrl] action key's numeric value for jLogo program.

See Also:
Constant Field Values

SHIFT

static final int SHIFT
[Shift] action key's numeric value for jLogo program.

See Also:
Constant Field Values
Method Detail

tgKeyPressed

void tgKeyPressed(int keyNum)
TGCanvas (a Component) passes on KeyListener.keyPressed() KeyEvents (simplified a bit) to classes that register with it and implement TGKeyHandler.

Parameters:
keyNum - a character or action key identifier
See Also:
ALT, CONTROL, DOWN_ARROW, LEFT_ARROW, RIGHT_ARROW, SHIFT, UP_ARROW

tgKeyReleased

void tgKeyReleased(int keyNum)
TGCanvas (a Component) passes on KeyListener.keyReleased() KeyEvents (simplified a bit) to classes that register with it and implement TGKeyHandler.

Parameters:
keyNum - a character or action key identifier
See Also:
ALT, CONTROL, DOWN_ARROW, LEFT_ARROW, RIGHT_ARROW, SHIFT, UP_ARROW

tgKeyTyped

void tgKeyTyped(char keyChar)
TGCanvas (a Component) passes on KeyListener.keyTyped() KeyEvents (simplified a bit) to classes that register with it and implement TGKeyHandler.

Parameters:
keyChar - a Unicode character