|
Josh Native console access wrapper for Java |
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.yifanlu.Josh.ConsoleEvent
com.yifanlu.Josh.ConsoleEventMouse
public class ConsoleEventMouse
Describes a mouse input event.
JoshInBuffer| Field Summary | |
|---|---|
static int |
DOUBLE_CLICK
Constant value for mouse event flag. |
static int |
FROM_LEFT_1ST_BUTTON_PRESSED
Constant value for mouse button. |
static int |
FROM_LEFT_2ND_BUTTON_PRESSED
Constant value for mouse button. |
static int |
FROM_LEFT_3RD_BUTTON_PRESSED
Constant value for mouse button. |
static int |
FROM_LEFT_4TH_BUTTON_PRESSED
Constant value for mouse button. |
static int |
MOUSE_HWHEELED
Constant value for mouse event flag. |
static int |
MOUSE_MOVED
Constant value for mouse event flag. |
static int |
MOUSE_WHEELED
Constant value for mouse event flag. |
static int |
RIGHTMOST_BUTTON_PRESSED
Constant value for mouse button. |
| Fields inherited from class com.yifanlu.Josh.ConsoleEvent |
|---|
CAPSLOCK_ON, ENHANCED_KEY, eventType, FOCUS_EVENT, KEY_EVENT, LEFT_ALT_PRESSED, LEFT_CTRL_PRESSED, MENU_EVENT, MOUSE_EVENT, NUMLOCK_ON, RIGHT_ALT_PRESSED, RIGHT_CTRL_PRESSED, SCROLLLOCK_ON, SHIFT_PRESSED, WINDOW_BUFFER_SIZE_EVENT |
| Constructor Summary | |
|---|---|
ConsoleEventMouse(ConsoleCoord mousePosition,
int buttonState,
int controlKeyState,
int eventFlags)
Creates a mouse event. |
|
| Method Summary | |
|---|---|
boolean |
equals(java.lang.Object anObject)
Compares two Objects, if both are ConsoleEventMouse and have the same values, they are equal. |
int |
getButtonState()
Gets the mouse button pressed. |
int |
getControlKeyState()
Gets any control keys pressed. |
int |
getEventFlags()
Gets the type of mouse input (click, double click, etc). |
ConsoleCoord |
getMousePosition()
Gets the current mouse position. |
int |
hashCode()
Returns a hash code. |
void |
setButtonState(int buttonState)
Sets the mouse button pressed. |
void |
setControlKeyState(int controlKeyState)
Sets any control keys pressed. |
void |
setEventFlags(int eventFlags)
Gets the type of mouse input (click, double click, etc). |
void |
setMousePosition(ConsoleCoord mousePosition)
Sets the current mouse position. |
java.lang.String |
toString()
A String representation of this object. |
| Methods inherited from class com.yifanlu.Josh.ConsoleEvent |
|---|
getEventType |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int FROM_LEFT_1ST_BUTTON_PRESSED
public static final int FROM_LEFT_2ND_BUTTON_PRESSED
public static final int FROM_LEFT_3RD_BUTTON_PRESSED
public static final int FROM_LEFT_4TH_BUTTON_PRESSED
public static final int RIGHTMOST_BUTTON_PRESSED
public static final int DOUBLE_CLICK
public static final int MOUSE_HWHEELED
public static final int MOUSE_MOVED
public static final int MOUSE_WHEELED
| Constructor Detail |
|---|
public ConsoleEventMouse(ConsoleCoord mousePosition,
int buttonState,
int controlKeyState,
int eventFlags)
mousePosition - The location of the cursor,
in terms of the console screen buffer's character-cell coordinates.buttonState - The status of the mouse buttons. The least significant bit corresponds
to the leftmost mouse button. The next least significant bit corresponds to the rightmost
mouse button. The next bit indicates the next-to-leftmost mouse button. The bits then
correspond left to right to the mouse buttons. A bit is 1 if the button was pressed.
Use the constants defined in this class to set.controlKeyState - The state of the control keys. Use the constants defined in ConsoleEvent
to set.eventFlags - The type of mouse event. If this value is zero, it indicates a mouse
button being pressed or released. Use the constants defined in this class to set.| Method Detail |
|---|
public ConsoleCoord getMousePosition()
public int getButtonState()
public int getControlKeyState()
ConsoleEvent to compare, and the OR operator to mix and match. For example:if((ConsoleEventKeyboard)keyEvent.getControlKeyState() == (ConsoleEvent.CAPSLOCK_ON | LEFT_ALT_PRESSED));
public int getEventFlags()
public void setMousePosition(ConsoleCoord mousePosition)
mousePosition - The location of the cursor,
in terms of the console screen buffer's character-cell coordinates.public void setButtonState(int buttonState)
buttonState - The status of the mouse buttons. The least significant bit corresponds
to the leftmost mouse button. The next least significant bit corresponds to the rightmost
mouse button. The next bit indicates the next-to-leftmost mouse button. The bits then
correspond left to right to the mouse buttons. A bit is 1 if the button was pressed.
Use the constants defined in this class to set.public void setControlKeyState(int controlKeyState)
ConsoleEvent.
controlKeyState - The state of the control keys.public void setEventFlags(int eventFlags)
eventFlags - The type of mouse event. If this value is zero, it indicates a mouse
button being pressed or released. Use the constants defined in this class to set.public boolean equals(java.lang.Object anObject)
equals in class java.lang.ObjectanObject - Another ConsoleEventMouse object.
public int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
String representation of this object.
toString in class java.lang.Object
|
Copyright © 2010 Yifan Lu | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||