uwcse.graphics
Class GWindowEvent

java.lang.Object
  |
  +--uwcse.graphics.GWindowEvent

public class GWindowEvent
extends java.lang.Object

This class defines an event object which can be generated in the GWindow world. Currently it includes the following kinds of events: mouse press, mouse release, mouse dragged, key press, key release, and timer expiration.


Field Summary
static int KEY_PRESSED
           
static int KEY_RELEASED
           
static int MOUSE_DRAGGED
           
static int MOUSE_PRESSED
           
static int MOUSE_RELEASED
           
static int TIMER_EXPIRED
           
 
Constructor Summary
GWindowEvent(int x, int y, char key, int type)
          Create a new GWindowEvent.
 
Method Summary
 char getKey()
          Answer the key that was pressed.
 int getType()
          Answer the type of this event.
 int getX()
          Answer the x position of the mouse click.
 int getY()
          Answer the y position of the mouse click.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

KEY_PRESSED

public static final int KEY_PRESSED

KEY_RELEASED

public static final int KEY_RELEASED

MOUSE_DRAGGED

public static final int MOUSE_DRAGGED

MOUSE_PRESSED

public static final int MOUSE_PRESSED

MOUSE_RELEASED

public static final int MOUSE_RELEASED

TIMER_EXPIRED

public static final int TIMER_EXPIRED
Constructor Detail

GWindowEvent

public GWindowEvent(int x,
                    int y,
                    char key,
                    int type)
Create a new GWindowEvent.
Parameters:
x - the x location of a mouse press
y - the y location of a mouse press
key - the character pressed on the keyboard
type - the kind of event.
Method Detail

getKey

public char getKey()
Answer the key that was pressed. The value is only meaningful if the event is of type KEY_PRESSED or KEY_RELEASED.

getType

public int getType()
Answer the type of this event.

getX

public int getX()
Answer the x position of the mouse click. The value is only meaningful if the event is of type MOUSE_PRESSED, MOUSE_RELEASED, or MOUSE_DRAGGED.

getY

public int getY()
Answer the y position of the mouse click. The value is only meaningful if the event is of type MOUSE_PRESSED, MOUSE_RELEASED, or MOUSE_DRAGGED.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object