|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ch.aplu.jgamegrid.GGMouse
public class GGMouse
Singleton class used to report mouse events. For rButton events are triggered by mouse button 2 or 3. Be aware that for some mouse events the reported mouse coordinates are not strictly restricted to the display area. Therefore GameGrid.toLocation() may report cell indices outside the visible grid. Use GameGrid.isInGrid() to test if they are valid grid locations or use GameGrid.toLocationsInGrid() in order to get only valid grid locations.
Field Summary | |
---|---|
static int |
enter
Mouse cursor enters the window. |
static int |
idle
No mouse event occured. |
static int |
lClick
Left mouse button down and up in a quick sequence. |
static int |
lDClick
Left mouse button down, up, down, up in a quick sequence. |
static int |
lDrag
Left mouse button down and move. |
static int |
leave
Mouse cursor leaves the window. |
static int |
lPress
Left mouse button down. |
static int |
lRelease
Left mouse button up. |
static int |
move
Mouse cursor is moved inside the window. |
static int |
rClick
Right mouse button down and up in a quick sequence. |
static int |
rDClick
Right mouse button down, up, down, up in a quick sequence. |
static int |
rDrag
Right mouse button down and move. |
static int |
rPress
Right mouse button down. |
static int |
rRelease
Right mouse button up. |
Method Summary | |
---|---|
static GGMouse |
create()
Creates a GGMouse instance with default values for the instance variables. |
static GGMouse |
create(GGMouseListener listener,
int evt,
int x,
int y)
Creates a GGMouse instance with given values for the instance variables. |
int |
getEvent()
Retrieves the current event type as integer. |
java.lang.String |
getEventType()
Returns the event type as string. |
GGMouseListener |
getSource()
Retrieves the GGMouseListener reference that created the event. |
int |
getX()
Retrieves the current x-coordinate of the mouse cursor with respect to the upper left corner of the visible area in pixels. |
int |
getY()
Retrieves the current y-coordinate of the mouse cursor with respect to the upper left corner of the visible area in pixels. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int idle
public static final int lPress
public static final int lRelease
public static final int lClick
public static final int lDClick
public static final int lDrag
public static final int rPress
public static final int rRelease
public static final int rClick
public static final int rDClick
public static final int rDrag
public static final int enter
public static final int leave
public static final int move
Method Detail |
---|
public static GGMouse create()
public static GGMouse create(GGMouseListener listener, int evt, int x, int y)
listener
- the listener instances that created the eventevt
- the event type (one of the predefined constants)x
- the x-coordinate where the event occurredy
- the y-coordinate where the event occurred
public GGMouseListener getSource()
public int getEvent()
public int getX()
public java.lang.String getEventType()
public int getY()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |