Weitere aktuelle Java-Titel finden Sie bei dpunkt.
 Inhaltsverzeichnis   Vorhergehendes Paket   Seite Zurück   Seite Vor   Nächstes Paket   Paketübersicht   Index

Klasse java.awt.event.KeyEvent1.1

java.lang.Object
   |
   +--java.util.EventObject
         |
         +--java.awt.AWTEvent
               |
               +--java.awt.event.ComponentEvent
                     |
                     +--java.awt.event.InputEvent
                           |
                           +--java.awt.event.KeyEvent

Deklaration

public class KeyEvent
extends java.awt.event.InputEvent

Beschreibung

Diese Klasse repräsentiert ein Key-Event. Sie werden beim Drücken oder Loslassen einer Taste ausgelöst. KeyEvent definiert zahlreiche Konstanten (»Virtual Keys«), die zur plattformunabhängigen Abfrage der gedrückten Taste verwendet werden können.


 
Datenelemente
public static final intKEY_FIRST
public static final intKEY_LAST
public final static intKEY_LOCATION_LEFT     [1.4]
public final static intKEY_LOCATION_NUMPAD     [1.4]
public final static intKEY_LOCATION_RIGHT     [1.4]
public final static intKEY_LOCATION_STANDARD     [1.4]
public final static intKEY_LOCATION_UNKNOWN     [1.4]
public static final intKEY_TYPED
public static final intKEY_PRESSED
public static final intKEY_RELEASED
public static final intVK_ENTER
public static final intVK_BACK_SPACE
public static final intVK_TAB
public static final intVK_CANCEL
public static final intVK_CLEAR
public static final intVK_SHIFT
public static final intVK_CONTROL
public static final intVK_ALT
public static final intVK_PAUSE
public static final intVK_CAPS_LOCK
public static final intVK_ESCAPE
public static final intVK_SPACE
public static final intVK_PAGE_UP
public static final intVK_PAGE_DOWN
public static final intVK_END
public static final intVK_HOME
public static final intVK_LEFT
public static final intVK_UP
public static final intVK_RIGHT
public static final intVK_DOWN
public static final intVK_COMMA
public static final intVK_MINUS
public static final intVK_PERIOD
public static final intVK_SLASH
public static final intVK_0
public static final intVK_1
public static final intVK_2
public static final intVK_3
public static final intVK_4
public static final intVK_5
public static final intVK_6
public static final intVK_7
public static final intVK_8
public static final intVK_9
public static final intVK_SEMICOLON
public static final intVK_EQUALS
public static final intVK_A
public static final intVK_B
public static final intVK_C
public static final intVK_D
public static final intVK_E
public static final intVK_F
public static final intVK_G
public static final intVK_H
public static final intVK_I
public final static intVK_INPUT_METHOD_ON_OFF     [1.3]
public static final intVK_J
public static final intVK_K
public static final intVK_L
public static final intVK_M
public static final intVK_N
public static final intVK_O
public static final intVK_P
public static final intVK_Q
public static final intVK_R
public static final intVK_S
public static final intVK_T
public static final intVK_U
public static final intVK_V
public static final intVK_W
public static final intVK_X
public static final intVK_Y
public static final intVK_Z
public static final intVK_OPEN_BRACKET
public static final intVK_BACK_SLASH
public static final intVK_CLOSE_BRACKET
public static final intVK_NUMPAD0
public static final intVK_NUMPAD1
public static final intVK_NUMPAD2
public static final intVK_NUMPAD3
public static final intVK_NUMPAD4
public static final intVK_NUMPAD5
public static final intVK_NUMPAD6
public static final intVK_NUMPAD7
public static final intVK_NUMPAD8
public static final intVK_NUMPAD9
public static final intVK_MULTIPLY
public static final intVK_ADD
public static final intVK_SEPARATER
public final static intVK_SEPARATOR     [1.4]
public static final intVK_SUBTRACT
public static final intVK_DECIMAL
public static final intVK_DIVIDE
public static final intVK_F1
public static final intVK_F2
public static final intVK_F3
public static final intVK_F4
public static final intVK_F5
public static final intVK_F6
public static final intVK_F7
public static final intVK_F8
public static final intVK_F9
public static final intVK_F10
public static final intVK_F11
public static final intVK_F12
public static final intVK_DELETE
public static final intVK_NUM_LOCK
public static final intVK_SCROLL_LOCK
public static final intVK_PRINTSCREEN
public static final intVK_INSERT
public static final intVK_HELP
public static final intVK_META
public static final intVK_BACK_QUOTE
public static final intVK_QUOTE
public static final intVK_KP_UP     [1.2]
public static final intVK_KP_DOWN     [1.2]
public static final intVK_KP_LEFT     [1.2]
public static final intVK_KP_RIGHT     [1.2]
public static final intVK_DEAD_GRAVE     [1.2]
public static final intVK_DEAD_ACUTE     [1.2]
public static final intVK_DEAD_CIRCUMFLEX     [1.2]
public static final intVK_DEAD_TILDE     [1.2]
public static final intVK_DEAD_MACRON     [1.2]
public static final intVK_DEAD_BREVE     [1.2]
public static final intVK_DEAD_ABOVEDOT     [1.2]
public static final intVK_DEAD_DIAERESIS     [1.2]
public static final intVK_DEAD_ABOVERING     [1.2]
public static final intVK_DEAD_DOUBLEACUTE     [1.2]
public static final intVK_DEAD_CARON     [1.2]
public static final intVK_DEAD_CEDILLA     [1.2]
public static final intVK_DEAD_OGONEK     [1.2]
public static final intVK_DEAD_IOTA     [1.2]
public static final intVK_DEAD_VOICED_SOUND     [1.2]
public static final intVK_DEAD_SEMIVOICED_SOUND     [1.2]
public static final intVK_AMPERSAND     [1.2]
public static final intVK_ASTERISK     [1.2]
public static final intVK_QUOTEDBL     [1.2]
public static final intVK_LESS     [1.2]
public static final intVK_GREATER     [1.2]
public static final intVK_BRACELEFT     [1.2]
public static final intVK_BRACERIGHT     [1.2]
public static final intVK_FINAL
public static final intVK_CONVERT
public static final intVK_NONCONVERT
public static final intVK_ACCEPT
public static final intVK_MODECHANGE
public static final intVK_KANA
public final static intVK_KANA_LOCK     [1.3]
public static final intVK_KANJI
public static final intVK_AT     [1.2]
public static final intVK_COLON     [1.2]
public static final intVK_CIRCUMFLEX     [1.2]
public static final intVK_DOLLAR     [1.2]
public static final intVK_EURO     [1.2]
public static final intVK_EXCLAMATION_MARK     [1.2]
public static final intVK_INVERTED_EXCLAMATION_MARK     [1.2]
public static final intVK_LEFT_PARENTHESIS     [1.2]
public static final intVK_NUMBER_SIGN     [1.2]
public static final intVK_PLUS     [1.2]
public static final intVK_RIGHT_PARENTHESIS     [1.2]
public static final intVK_UNDERSCORE     [1.2]
public static final intVK_FINAL     [1.2]
public static final intVK_CONVERT     [1.2]
public static final intVK_NONCONVERT     [1.2]
public static final intVK_ACCEPT     [1.2]
public static final intVK_MODECHANGE     [1.2]
public static final intVK_ALPHANUMERIC     [1.2]
public static final intVK_KATAKANA     [1.2]
public static final intVK_HIRAGANA     [1.2]
public static final intVK_FULL_WIDTH     [1.2]
public static final intVK_HALF_WIDTH     [1.2]
public static final intVK_ROMAN_CHARACTERS     [1.2]
public static final intVK_ALL_CANDIDATES     [1.2]
public static final intVK_PREVIOUS_CANDIDATE     [1.2]
public static final intVK_CODE_INPUT     [1.2]
public static final intVK_JAPANESE_KATAKANA     [1.2]
public static final intVK_JAPANESE_HIRAGANA     [1.2]
public static final intVK_JAPANESE_ROMAN     [1.2]
public static final intVK_CUT     [1.2]
public static final intVK_COPY     [1.2]
public static final intVK_PASTE     [1.2]
public static final intVK_UNDO     [1.2]
public static final intVK_AGAIN     [1.2]
public static final intVK_FIND     [1.2]
public static final intVK_PROPS     [1.2]
public static final intVK_STOP     [1.2]
public static final intVK_COMPOSE     [1.2]
public static final intVK_ALT_GRAPH;     [1.2]
public static final intVK_UNDEFINED
public static final charCHAR_UNDEFINED
 
Konstruktoren
publicKeyEvent(Component source, int id, long when, int modifiers, int keyCode)
      Verworfen in Version 1.1.
publicKeyEvent(Component source, int id, long when, int modifiers, int keyCode, char keyChar)
 
Methoden
public chargetKeyChar()
public intgetKeyCode()
public intgetKeyLocation()     [1.4]
public static StringgetKeyModifiersText(int modifiers)     [1.2]
public static StringgetKeyText(int keyCode)
public booleanisActionKey()
public StringparamString()
public voidsetKeyChar(char keyChar)
public voidsetKeyCode(int keyCode)
public voidsetModifiers(int modifiers)     [1.2]


 

Datenelemente im Detail

public static final int KEY_FIRST
Die kleinste ID der Ereignis-Typen für Key-Events.
public static final int KEY_LAST
Die größte ID der Ereignis-Typen für Key-Events.
public final static int KEY_LOCATION_LEFT     [1.4]
Die Konstante, die angibt, dass die linke Variante gewählt wurde (z.B. die linke »Shift«-Taste).
public final static int KEY_LOCATION_NUMPAD     [1.4]
Konstante, die angibt, dass der Nummernblock benutzt wurde.
public final static int KEY_LOCATION_RIGHT     [1.4]
Die Konstante, die angibt, dass die rechte Variante gewählt wurde (z.B. die rechte »Shift«-Taste).
public final static int KEY_LOCATION_STANDARD     [1.4]
Konstante, die sagt, dass es keine Variabten gibt.
public final static int KEY_LOCATION_UNKNOWN     [1.4]
Konstante für einen unbekannten Status.
public static final int KEY_TYPED
Ereignis-Typ für das Tippen einer Taste. Wird ausgelöst, wenn eine Taste gedrückt und losgelassen wird.
public static final int KEY_PRESSED
Ereignis-Typ für das Drücken einer Taste.
public static final int KEY_RELEASED
Ereignis-Typ für das Loslassen einer Taste.
public static final int VK_ENTER
public static final int VK_BACK_SPACE
public static final int VK_TAB
public static final int VK_CANCEL
public static final int VK_CLEAR
public static final int VK_SHIFT
public static final int VK_CONTROL
public static final int VK_ALT
public static final int VK_PAUSE
public static final int VK_CAPS_LOCK
public static final int VK_ESCAPE
public static final int VK_SPACE
public static final int VK_PAGE_UP
public static final int VK_PAGE_DOWN
public static final int VK_END
public static final int VK_HOME
public static final int VK_LEFT
public static final int VK_UP
public static final int VK_RIGHT
public static final int VK_DOWN
public static final int VK_COMMA
public static final int VK_MINUS
public static final int VK_PERIOD
public static final int VK_SLASH
public static final int VK_0
public static final int VK_1
public static final int VK_2
public static final int VK_3
public static final int VK_4
public static final int VK_5
public static final int VK_6
public static final int VK_7
public static final int VK_8
public static final int VK_9
public static final int VK_SEMICOLON
public static final int VK_EQUALS
public static final int VK_A
public static final int VK_B
public static final int VK_C
public static final int VK_D
public static final int VK_E
public static final int VK_F
public static final int VK_G
public static final int VK_H
public static final int VK_I
public final static int VK_INPUT_METHOD_ON_OFF     [1.3]
public static final int VK_J
public static final int VK_K
public static final int VK_L
public static final int VK_M
public static final int VK_N
public static final int VK_O
public static final int VK_P
public static final int VK_Q
public static final int VK_R
public static final int VK_S
public static final int VK_T
public static final int VK_U
public static final int VK_V
public static final int VK_W
public static final int VK_X
public static final int VK_Y
public static final int VK_Z
public static final int VK_OPEN_BRACKET
public static final int VK_BACK_SLASH
public static final int VK_CLOSE_BRACKET
public static final int VK_NUMPAD0
public static final int VK_NUMPAD1
public static final int VK_NUMPAD2
public static final int VK_NUMPAD3
public static final int VK_NUMPAD4
public static final int VK_NUMPAD5
public static final int VK_NUMPAD6
public static final int VK_NUMPAD7
public static final int VK_NUMPAD8
public static final int VK_NUMPAD9
public static final int VK_MULTIPLY
public static final int VK_ADD
public static final int VK_SEPARATER
public final static int VK_SEPARATOR     [1.4]
public static final int VK_SUBTRACT
public static final int VK_DECIMAL
public static final int VK_DIVIDE
public static final int VK_F1
public static final int VK_F2
public static final int VK_F3
public static final int VK_F4
public static final int VK_F5
public static final int VK_F6
public static final int VK_F7
public static final int VK_F8
public static final int VK_F9
public static final int VK_F10
public static final int VK_F11
public static final int VK_F12
public static final int VK_DELETE
public static final int VK_NUM_LOCK
public static final int VK_SCROLL_LOCK
public static final int VK_PRINTSCREEN
public static final int VK_INSERT
public static final int VK_HELP
public static final int VK_META
public static final int VK_BACK_QUOTE
public static final int VK_QUOTE
public static final int VK_KP_UP     [1.2]
public static final int VK_KP_DOWN     [1.2]
public static final int VK_KP_LEFT     [1.2]
public static final int VK_KP_RIGHT     [1.2]
public static final int VK_DEAD_GRAVE     [1.2]
public static final int VK_DEAD_ACUTE     [1.2]
public static final int VK_DEAD_CIRCUMFLEX     [1.2]
public static final int VK_DEAD_TILDE     [1.2]
public static final int VK_DEAD_MACRON     [1.2]
public static final int VK_DEAD_BREVE     [1.2]
public static final int VK_DEAD_ABOVEDOT     [1.2]
public static final int VK_DEAD_DIAERESIS     [1.2]
public static final int VK_DEAD_ABOVERING     [1.2]
public static final int VK_DEAD_DOUBLEACUTE     [1.2]
public static final int VK_DEAD_CARON     [1.2]
public static final int VK_DEAD_CEDILLA     [1.2]
public static final int VK_DEAD_OGONEK     [1.2]
public static final int VK_DEAD_IOTA     [1.2]
public static final int VK_DEAD_VOICED_SOUND     [1.2]
public static final int VK_DEAD_SEMIVOICED_SOUND     [1.2]
public static final int VK_AMPERSAND     [1.2]
public static final int VK_ASTERISK     [1.2]
public static final int VK_QUOTEDBL     [1.2]
public static final int VK_LESS     [1.2]
public static final int VK_GREATER     [1.2]
public static final int VK_BRACELEFT     [1.2]
public static final int VK_BRACERIGHT     [1.2]
public static final int VK_FINAL
public static final int VK_CONVERT
public static final int VK_NONCONVERT
public static final int VK_ACCEPT
public static final int VK_MODECHANGE
public static final int VK_KANA
public final static int VK_KANA_LOCK     [1.3]
public static final int VK_KANJI
public static final int VK_AT     [1.2]
Das Zeichen @.
public static final int VK_COLON     [1.2]
Das Zeichen :.
public static final int VK_CIRCUMFLEX     [1.2]
Der Circumflex-Akzent.
public static final int VK_DOLLAR     [1.2]
Das Zeichen $.
public static final int VK_EURO     [1.2]
Das Euro-Währungssymbol.
public static final int VK_EXCLAMATION_MARK     [1.2]
Das Zeichen !.
public static final int VK_INVERTED_EXCLAMATION_MARK     [1.2]
Das umgedrehte !.
public static final int VK_LEFT_PARENTHESIS     [1.2]
Das Zeichen (.
public static final int VK_NUMBER_SIGN     [1.2]
Das Zeichen #.
public static final int VK_PLUS     [1.2]
Das Zeichen +.
public static final int VK_RIGHT_PARENTHESIS     [1.2]
Das Zeichen ).
public static final int VK_UNDERSCORE     [1.2]
Das Zeichen _.
public static final int VK_FINAL     [1.2]
Zur Unterstützung asiatischer Tastaturen.
public static final int VK_CONVERT     [1.2]
Zur Unterstützung asiatischer Tastaturen.
public static final int VK_NONCONVERT     [1.2]
Zur Unterstützung asiatischer Tastaturen.
public static final int VK_ACCEPT     [1.2]
Zur Unterstützung asiatischer Tastaturen.
public static final int VK_MODECHANGE     [1.2]
Zur Unterstützung asiatischer Tastaturen.
public static final int VK_ALPHANUMERIC     [1.2]
Zur Unterstützung japanischer PC106-Tastaturen.
public static final int VK_KATAKANA     [1.2]
Zur Unterstützung japanischer PC106-Tastaturen.
public static final int VK_HIRAGANA     [1.2]
Zur Unterstützung japanischer PC106-Tastaturen.
public static final int VK_FULL_WIDTH     [1.2]
Zur Unterstützung japanischer PC106-Tastaturen.
public static final int VK_HALF_WIDTH     [1.2]
Zur Unterstützung japanischer PC106-Tastaturen.
public static final int VK_ROMAN_CHARACTERS     [1.2]
Zur Unterstützung japanischer PC106-Tastaturen.
public static final int VK_ALL_CANDIDATES     [1.2]
Zur Unterstützung japanischer PC106-Tastaturen.
public static final int VK_PREVIOUS_CANDIDATE     [1.2]
Zur Unterstützung japanischer PC106-Tastaturen.
public static final int VK_CODE_INPUT     [1.2]
Zur Unterstützung japanischer PC106-Tastaturen.
public static final int VK_JAPANESE_KATAKANA     [1.2]
Zur Unterstützung japanischer Mac-Tastaturen.
public static final int VK_JAPANESE_HIRAGANA     [1.2]
Zur Unterstützung japanischer Mac-Tastaturen.
public static final int VK_JAPANESE_ROMAN     [1.2]
Zur Unterstützung japanischer Mac-Tastaturen.
public static final int VK_CUT     [1.2]
Zur Unterstützung von Sun-Tastaturen.
public static final int VK_COPY     [1.2]
Zur Unterstützung von Sun-Tastaturen.
public static final int VK_PASTE     [1.2]
Zur Unterstützung von Sun-Tastaturen.
public static final int VK_UNDO     [1.2]
Zur Unterstützung von Sun-Tastaturen.
public static final int VK_AGAIN     [1.2]
Zur Unterstützung von Sun-Tastaturen.
public static final int VK_FIND     [1.2]
Zur Unterstützung von Sun-Tastaturen.
public static final int VK_PROPS     [1.2]
Zur Unterstützung von Sun-Tastaturen.
public static final int VK_STOP     [1.2]
Zur Unterstützung von Sun-Tastaturen.
public static final int VK_COMPOSE     [1.2]
public static final int VK_ALT_GRAPH;     [1.2]
public static final int VK_UNDEFINED
public static final char CHAR_UNDEFINED
Code für eine undefinierte Taste.

 

Konstruktoren im Detail

public KeyEvent(Component source, int id, long when, int modifiers, int keyCode)
Erzeugt ein neues KeyEvent.
public KeyEvent(Component source, int id, long when, int modifiers, int keyCode, char keyChar)
Erzeugt ein neues KeyEvent mit dem Auslöser source, dem Typ id und dem Eintrittszeitpunkt when. Die Taste wird durch den virtuellen Code keyCode und die in modifiers gesetzten Zusatztasten beschrieben. Falls es sich um ein Unicode-Zeichen handelt, ist es in keyChar enthalten, ansonsten hat keyChar den Wert CHAR_UNDEFINED.

 

Methoden im Detail

public char getKeyChar()
Liefert das Unicode-Zeichen der Taste. Falls es sich um eine Sondertaste handelt, ist der Rückgabewert CHAR_UNDEFINED.
public int getKeyCode()
Liefert den virtuellen Code der Taste. Bei KEY_TYPED-Events ist der Rückgabewert VK_UNDEFINED.
public int getKeyLocation()     [1.4]
Liefert die Position der Taste (z.B. linke oder rechte »Shift«-Taste.
public static String getKeyModifiersText(int modifiers)     [1.2]
Liefert einen Text, der die in modifiers gesetzten Modifier-Tasten enthält.
public static String getKeyText(int keyCode)
Liefert den Namen der Taste. Mit dieser Methode können insbesondere die Namen der Sondertasten ermittelt werden.
public boolean isActionKey()
Liefert true, falls es sich um eine Aktionstaste handelt, sonst false.
public String paramString()
Liefert einen String, der den Ereignis-Typ und den Namen der Taste enthält.
public void setKeyChar(char keyChar)
Setzt das Unicode-Zeichen des Ereignisses auf keyChar.
public void setKeyCode(int keyCode)
Setzt den virtuellen Tastencode des Ereignisses auf keyCode.
public void setModifiers(int modifiers)     [1.2]
Setzt die Modifier-Tasten des Events mit der Bitmaske modifiers.


 Inhaltsverzeichnis   Vorhergehendes Paket   Seite Zurück   Seite Vor   Nächstes Paket   Paketübersicht   Index

Copyright © 2002 dpunkt.Verlag, Heidelberg. Alle Rechte vorbehalten.