Josh
Native console access wrapper for Java

com.yifanlu.Josh
Class ConsoleEvent

java.lang.Object
  extended by com.yifanlu.Josh.ConsoleEvent
Direct Known Subclasses:
ConsoleEventBufferChanged, ConsoleEventFocus, ConsoleEventKeyboard, ConsoleEventMenu, ConsoleEventMouse

public abstract class ConsoleEvent
extends java.lang.Object

Describes an input event in the console input buffer. These records can be read from the input buffer by using the ReadConsoleInput or PeekConsoleInput function, or written to the input buffer by using the WriteConsoleInput function.
Note that you can not create an object directly from this class. You must define the event. For example (assuming all variables are declared):
ConsoleEvent keyEvent = new ConsoleEventKeyboard((boolean)bKeyDown, (int)wRepeatCount, (int)wVirtualKeyCode, (int)wVirtualScanCode, (char)uChar, (int)dwControlKeyState);

Since:
0.1
Version:
1.3, 05/29/10
Author:
Yifan Lu
See Also:
JoshInBuffer

Field Summary
static int CAPSLOCK_ON
          Constant value for key held.
static int ENHANCED_KEY
          Constant value for key held.
protected  int eventType
           
static int FOCUS_EVENT
          Different type of event.
static int KEY_EVENT
          Different type of event.
static int LEFT_ALT_PRESSED
          Constant value for key held.
static int LEFT_CTRL_PRESSED
          Constant value for key held.
static int MENU_EVENT
          Different type of event.
static int MOUSE_EVENT
          Different type of event.
static int NUMLOCK_ON
          Constant value for key held.
static int RIGHT_ALT_PRESSED
          Constant value for key held.
static int RIGHT_CTRL_PRESSED
          Constant value for key held.
static int SCROLLLOCK_ON
          Constant value for key held.
static int SHIFT_PRESSED
          Constant value for key held.
static int WINDOW_BUFFER_SIZE_EVENT
          Different type of event.
 
Constructor Summary
ConsoleEvent()
           
 
Method Summary
 int getEventType()
          Gets the event type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

eventType

protected int eventType

FOCUS_EVENT

public static final int FOCUS_EVENT
Different type of event.

See Also:
Constant Field Values

KEY_EVENT

public static final int KEY_EVENT
Different type of event.

See Also:
Constant Field Values

MENU_EVENT

public static final int MENU_EVENT
Different type of event.

See Also:
Constant Field Values

MOUSE_EVENT

public static final int MOUSE_EVENT
Different type of event.

See Also:
Constant Field Values

WINDOW_BUFFER_SIZE_EVENT

public static final int WINDOW_BUFFER_SIZE_EVENT
Different type of event.

See Also:
Constant Field Values

CAPSLOCK_ON

public static final int CAPSLOCK_ON
Constant value for key held.

See Also:
Constant Field Values

ENHANCED_KEY

public static final int ENHANCED_KEY
Constant value for key held.

See Also:
Constant Field Values

LEFT_ALT_PRESSED

public static final int LEFT_ALT_PRESSED
Constant value for key held.

See Also:
Constant Field Values

LEFT_CTRL_PRESSED

public static final int LEFT_CTRL_PRESSED
Constant value for key held.

See Also:
Constant Field Values

NUMLOCK_ON

public static final int NUMLOCK_ON
Constant value for key held.

See Also:
Constant Field Values

RIGHT_ALT_PRESSED

public static final int RIGHT_ALT_PRESSED
Constant value for key held.

See Also:
Constant Field Values

RIGHT_CTRL_PRESSED

public static final int RIGHT_CTRL_PRESSED
Constant value for key held.

See Also:
Constant Field Values

SCROLLLOCK_ON

public static final int SCROLLLOCK_ON
Constant value for key held.

See Also:
Constant Field Values

SHIFT_PRESSED

public static final int SHIFT_PRESSED
Constant value for key held.

See Also:
Constant Field Values
Constructor Detail

ConsoleEvent

public ConsoleEvent()
Method Detail

getEventType

public int getEventType()
Gets the event type.

Returns:
An hex value of the event, test it with the event constants (ConsoleEvent.KEY_EVENT).

Copyright © 2010 Yifan Lu