public class Event extends Object
Event objects to one of these special
subclasses (e.g. asKeyEvent(), which will cast the event to a KeyEvent,
if possible).Window.pollEvents(),
Event.Type| Modifier and Type | Class and Description |
|---|---|
static class |
Event.Type
Enumeration of available window event types.
|
| Modifier and Type | Field and Description |
|---|---|
Event.Type |
type
The type of the window event.
|
| Constructor and Description |
|---|
Event(int type)
Constructs a new event.
|
| Modifier and Type | Method and Description |
|---|---|
JoystickButtonEvent |
asJoystickButtonEvent()
Attempts to cast this event to a
JoystickButtonEvent. |
JoystickEvent |
asJoystickEvent()
Attempts to cast this event to a
JoystickEvent. |
JoystickMoveEvent |
asJoystickMoveEvent()
Attempts to cast this event to a
JoystickMoveEvent. |
KeyEvent |
asKeyEvent()
Attempts to cast this event to a
KeyEvent. |
MouseButtonEvent |
asMouseButtonEvent()
Attempts to cast this event to a
MouseButtonEvent. |
MouseEvent |
asMouseEvent()
Attempts to cast this event to a
MouseEvent. |
MouseWheelEvent |
asMouseWheelEvent()
Attempts to cast this event to a
MouseWheelEvent. |
SizeEvent |
asSizeEvent()
Attempts to cast this event to a
SizeEvent. |
TextEvent |
asTextEvent()
Attempts to cast this event to a
TextEvent. |
public final Event.Type type
Event.Typepublic Event(int type)
type - the type of the event.
This must be a valid ordinal in the Event.Type enumeration.public JoystickButtonEvent asJoystickButtonEvent()
JoystickButtonEvent.JoystickButtonEvent if its type is either
Event.Type.JOYSTICK_BUTTON_PRESSED or Event.Type.JOYSTICK_BUTTON_RELEASED,
null otherwise.public JoystickEvent asJoystickEvent()
JoystickEvent.JoystickEvent if its type is one of
Event.Type.JOYSTICK_CONNECETED, Event.Type.JOYSTICK_DISCONNECTED,
Event.Type.JOYSTICK_BUTTON_PRESSED, Event.Type.JOYSTICK_BUTTON_RELEASED or
Event.Type.JOYSTICK_MOVED, null otherwise.public JoystickMoveEvent asJoystickMoveEvent()
JoystickMoveEvent.JoystickButtonEvent if its type is
Event.Type.JOYSTICK_MOVED, null otherwise.public KeyEvent asKeyEvent()
KeyEvent.KeyEvent if its type is either
Event.Type.KEY_PRESSED or Event.Type.KEY_RELEASED,
null otherwise.public MouseButtonEvent asMouseButtonEvent()
MouseButtonEvent.MouseButtonEvent if its type is either
Event.Type.MOUSE_BUTTON_PRESSED or Event.Type.MOUSE_BUTTON_RELEASED,
null otherwise.public MouseEvent asMouseEvent()
MouseEvent.MouseEvent if its type is one of
Event.Type.MOUSE_ENTERED, Event.Type.MOUSE_MOVED,
Event.Type.MOUSE_LEFT, Event.Type.MOUSE_BUTTON_PRESSED,
Event.Type.MOUSE_BUTTON_RELEASED or Event.Type.MOUSE_WHEEL_MOVED,
null otherwise.public MouseWheelEvent asMouseWheelEvent()
MouseWheelEvent.MouseWheelEvent if its type is
Event.Type.MOUSE_WHEEL_MOVED, null otherwise.public SizeEvent asSizeEvent()
SizeEvent.SizeEvent if its type is
Event.Type.RESIZED, null otherwise.public TextEvent asTextEvent()
TextEvent.TextEvent if its type is
Event.Type.TEXT_ENTERED, null otherwise.