org.zaval.lw.event
Class LwKeyEvent

java.lang.Object
  |
  +--java.util.EventObject
        |
        +--org.zaval.lw.event.LwAWTEvent
              |
              +--org.zaval.lw.event.LwKeyEvent
All Implemented Interfaces:
java.io.Serializable

public class LwKeyEvent
extends LwAWTEvent

This class is used with light weight components to describe keyboard events.

See Also:
Serialized Form

Field Summary
static int KEY_PRESSED
          The key pressed event type.
static int KEY_RELEASED
          The key released event type.
static int KEY_TYPED
          The key typed event type.
 
Fields inherited from class org.zaval.lw.event.LwAWTEvent
COMP_UID, CONT_UID, FOCUS_UID, id, KEY_UID, MOTION_UID, MOUSE_UID, WIN_UID
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
LwKeyEvent(LwComponent target, int id, int code, char ch, int mask)
          Constructs the event object with the specified source object, the event id, the key code associated with the key, the character that has been typed with the key and the mask that describes state of a keyboard.
 
Method Summary
 char getKeyChar()
          Gets the key character that has been typed.
 int getKeyCode()
          Gets the key code associated with the key in the event.
 int getMask()
          Gets the keyboard mask.
 int getUID()
          Gets the UID of the event.
 void reset(LwComponent target, int id, int code, char ch, int mask)
           
 
Methods inherited from class org.zaval.lw.event.LwAWTEvent
getID, getLwComponent
 
Methods inherited from class java.util.EventObject
getSource, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

KEY_TYPED

public static final int KEY_TYPED
The key typed event type.

KEY_RELEASED

public static final int KEY_RELEASED
The key released event type.

KEY_PRESSED

public static final int KEY_PRESSED
The key pressed event type.
Constructor Detail

LwKeyEvent

public LwKeyEvent(LwComponent target,
                  int id,
                  int code,
                  char ch,
                  int mask)
Constructs the event object with the specified source object, the event id, the key code associated with the key, the character that has been typed with the key and the mask that describes state of a keyboard.
Parameters:
target - the object where the event originated.
id - the specified event id.
code - the specified key code associated with the key.
ch - the specified key character.
mask - the specified key mask. Using the mask you can define for example status of "Ctrl", "Alt", "Shift" and so on keys.
Method Detail

reset

public void reset(LwComponent target,
                  int id,
                  int code,
                  char ch,
                  int mask)

getKeyCode

public int getKeyCode()
Gets the key code associated with the key in the event.
Returns:
a key code.

getKeyChar

public char getKeyChar()
Gets the key character that has been typed.
Returns:
a key character.

getMask

public int getMask()
Gets the keyboard mask. The mask can be used to test if the "Ctrl", "Alt" and so on keys are pressed or not. Use java.awt.event.InputEvent key modifiers constants for the purpose.
Returns:
a keyboard mask.

getUID

public int getUID()
Gets the UID of the event. The class uses LwAWTEvent.KEY_UID as the event UID.
Overrides:
getUID in class LwAWTEvent
Returns:
an UID.


Copyright © Zaval Creative Engineering Group, 2000-2005.
http://www.zaval.org