Package codedraw
Class KeyDownEvent
java.lang.Object
codedraw.Event
codedraw.KeyDownEvent
This argument is given exactly once every time a key is pressed down.
-
Method Summary
Modifier and TypeMethodDescriptionchargetChar()Gets the character representation of the key that was pressed.intReturns the key code of the key pressed.getKey()Gets the key that was pressed to trigger the event.booleanGets whether alt was pressed.booleanGets whether alt graph was pressed.booleanGets whether control was pressed.booleanGets whether shift was pressed.toString()Methods inherited from class codedraw.Event
getTimeCreated
-
Method Details
-
getKey
Gets the key that was pressed to trigger the event. If the key is not found or unknown the key valueKey.UNDEFINEDwill be used.- Returns:
- a key.
-
getChar
public char getChar()Gets the character representation of the key that was pressed. For example pressing the A key + SHIFT will result in an 'A', but without pressing SHIFT will result in a lowercase 'a'.- Returns:
- a char.
-
getExtendedKeyCode
public int getExtendedKeyCode()Returns the key code of the key pressed. The extended key code can be used to uniquely identify a key on a keyboard.- Returns:
- the key code.
-
isControlDown
public boolean isControlDown()Gets whether control was pressed.- Returns:
- true if control was pressed, otherwise false.
-
isAltDown
public boolean isAltDown()Gets whether alt was pressed.- Returns:
- true if alt was pressed, otherwise false.
-
isAltGraphDown
public boolean isAltGraphDown()Gets whether alt graph was pressed.- Returns:
- true if alt graph was pressed, otherwise false.
-
isShiftDown
public boolean isShiftDown()Gets whether shift was pressed.- Returns:
- true if shift was pressed, otherwise false.
-
toString
-