|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jagatoo.input.devices.InputDevice
org.jagatoo.input.devices.Keyboard
public abstract class Keyboard
This is the base-class for all Keyboard implementations.
Applications should always use instances as Keyboard, but never cast them to
the concrete implementation.
Instances can only be created/retrieved through an InputDeviceFactory.
| Constructor Summary | |
|---|---|
protected |
Keyboard(KeyboardFactory sourceFactory,
InputSourceWindow sourceWindow,
EventQueue eventQueue,
java.lang.String name)
|
| Method Summary | |
|---|---|
void |
addKeyboardListener(KeyboardListener l)
Adds a KeyboardListener to the list of notified instances. |
protected int |
applyModifier(Key key,
boolean isKeyDown)
Combines the given key's maks-value to the modifier-mask, if the Key is a modifier. |
void |
destroy()
Destroys the InputDevice. |
protected abstract void |
destroyImpl()
Destroys the Keyboard. |
void |
fireKeyboardEvent(KeyboardEvent e,
boolean consumeEvent)
this method simply forwards to the concrete fire* methods. |
void |
fireOnKeyPressed(KeyPressedEvent e,
boolean consumeEvent)
Fires a KeyPressedEvent and pushes it back to the pool,
if consumeEvent is true. |
void |
fireOnKeyReleased(KeyReleasedEvent e,
boolean consumeEvent)
Fires a KeyReleasedEvent and pushes it back to the pool,
if consumeEvent is true. |
void |
fireOnKeyTyped(KeyTypedEvent e,
boolean consumeEvent)
Fires a KeyTypedEvent and pushes it back to the pool,
if consumeEvent is true. |
InputState |
getKeyState(Key key)
|
int |
getModifierMask()
|
KeyboardFactory |
getSourceFactory()
|
int |
getState(DeviceComponent component)
This method returns an abstract input-state for the given DeviceComponent. |
boolean |
hasKeyboardListener()
|
protected abstract boolean |
hasKeyStateChanged(Key key,
boolean keyState)
This method is asked by the fireOnKeyPressed(KeyPressedEvent, boolean)
and fireOnKeyReleased(KeyReleasedEvent, boolean) methods
and listeners are not notified, if this method returns false. |
boolean |
hasListener()
|
boolean |
isKeyPressed(Key key)
|
protected KeyPressedEvent |
prepareKeyPressedEvent(Key key,
int modifierMask,
long when,
long lastWhen)
Prepares a KeyPressedEvent for being fired. |
protected KeyReleasedEvent |
prepareKeyReleasedEvent(Key key,
int modifierMask,
long when,
long lastWhen)
Prepares a KeyReleasedEvent for being fired. |
protected KeyTypedEvent |
prepareKeyTypedEvent(char keyChar,
int modifierMask,
long when,
long lastWhen)
Prepares a KeyTypedEvent for being fired. |
void |
removeKeyboardListener(KeyboardListener l)
Removes a KeyboardListener from the list of notified instances. |
java.lang.String |
toString()
|
| Methods inherited from class org.jagatoo.input.devices.InputDevice |
|---|
addInputStateListener, collectEvents, consumePendingEvents, equals, fireStateEventsAndDoActions, getEventQueue, getName, getSourceWindow, hasInputStateListener, isEnabled, onDeviceRegistered, onDeviceUnregistered, removeInputStateListener, setEnabled, update |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
protected Keyboard(KeyboardFactory sourceFactory,
InputSourceWindow sourceWindow,
EventQueue eventQueue,
java.lang.String name)
throws InputSystemException
InputSystemException| Method Detail |
|---|
public final KeyboardFactory getSourceFactory()
KeyboardFactory, that created this instance.public final boolean hasKeyboardListener()
KeyboardListener is currently registered.public final boolean hasListener()
InputDevice.hasInputStateListener() or hasKeyboardListener() return true.public void addKeyboardListener(KeyboardListener l)
KeyboardListener to the list of notified instances.
l - public void removeKeyboardListener(KeyboardListener l)
KeyboardListener from the list of notified instances.
l -
protected int applyModifier(Key key,
boolean isKeyDown)
key - isKeyDown -
public final int getModifierMask()
protected final KeyPressedEvent prepareKeyPressedEvent(Key key,
int modifierMask,
long when,
long lastWhen)
KeyPressedEvent for being fired.
key - modifierMask - when - lastWhen -
null, if no events are currently accepted.
protected abstract boolean hasKeyStateChanged(Key key,
boolean keyState)
fireOnKeyPressed(KeyPressedEvent, boolean)
and fireOnKeyReleased(KeyReleasedEvent, boolean) methods
and listeners are not notified, if this method returns false.
key - keyState -
public final void fireOnKeyPressed(KeyPressedEvent e,
boolean consumeEvent)
KeyPressedEvent and pushes it back to the pool,
if consumeEvent is true.
e - consumeEvent -
protected final KeyReleasedEvent prepareKeyReleasedEvent(Key key,
int modifierMask,
long when,
long lastWhen)
KeyReleasedEvent for being fired.
key - modifierMask - when - lastWhen -
null, if no events are currently accepted.
public final void fireOnKeyReleased(KeyReleasedEvent e,
boolean consumeEvent)
KeyReleasedEvent and pushes it back to the pool,
if consumeEvent is true.
e - consumeEvent -
protected final KeyTypedEvent prepareKeyTypedEvent(char keyChar,
int modifierMask,
long when,
long lastWhen)
KeyTypedEvent for being fired.
keyChar - modifierMask - when - lastWhen -
null, if no events are currently accepted.
public final void fireOnKeyTyped(KeyTypedEvent e,
boolean consumeEvent)
KeyTypedEvent and pushes it back to the pool,
if consumeEvent is true.
e - consumeEvent -
public final void fireKeyboardEvent(KeyboardEvent e,
boolean consumeEvent)
e - consumeEvent - public final boolean isKeyPressed(Key key)
key -
public final InputState getKeyState(Key key)
key -
public int getState(DeviceComponent component)
throws InputSystemRuntimeException
getState in class InputDeviceInputSystemRuntimeExceptionpublic java.lang.String toString()
toString in class java.lang.Object
protected abstract void destroyImpl()
throws InputSystemException
InputSystemException
public final void destroy()
throws InputSystemException
destroy in class InputDeviceInputSystemException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||