|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--gumbo.util.AbstractDisposable | +--gumbo.graphic.input.AbstractKeyboardSensor | +--gumbo.graphic.input.impl.swing.SwingKeyboardSensor
An AWT/Swing keyboard sensor. Sensor targets must have a Component graphic. Senses keyboard events when a target has focus. Focus can transfer to the target directly, through manual focus (key click, focus navigation), or indirectly, using getKeyboardFocusIn(). The key state is cleared but not output upon loss of focus, and it is set according to getKeyboardFocusKeysIn() upon request or gain of focus.
Swing does not allow monitoring of the keyboard directly. Instead, each target graphic with keyboard focus must be monitored for key inputs. Also, Swing does not provide the keyboard state upon gaining focus. As such, this class uses getKeyboardFocusKeysIn() for the initial state when a critical event occurs (target enetered, button changed) prior to requesting or gaining focus (see SwingMouseSensor). To be safe, it also recognizes key releases without a prior corresponding key press.
Constructor Summary | |
SwingKeyboardSensor()
Creates an instance, with keyRepeat false. |
|
SwingKeyboardSensor(boolean keyRepeat)
Creates an instance. |
Method Summary | |
protected void |
addedSensorTarget(SpaceNode target)
Throws an exception if target graphic not a Component. |
BooleanField.EventOut |
getKeyboardActiveOut()
Sends an event when the sensor starts or stops being active on a given sensor target. |
BooleanField.EventIn |
getKeyboardEnableIn()
Enables/disables this sensor. |
SpaceNodeField.EventIn |
getKeyboardFocusIn()
Tries to gain keyboard focus for a sensor target, but only if the target's window is active. |
CollectionField.EventIn |
getKeyboardFocusKeysIn()
The state (KeyboardSensors.KEY_???) of the keyboard keys before keyboard focus is requested or gained. |
BooleanField.EventIn |
getKeyboardPickActiveIn()
If going true while this sensor is active, resends the keyboard keys. |
SpaceNodeField.EventOut |
getKeyboardSpaceOut()
Sends an event when the sensor starts being active in a new sensor target space. |
protected void |
implDispose()
Called by dispose() before the disposed flag is set, when it is time for subclasses to dispose themselves. |
protected void |
removedSensorTarget(SpaceNode target)
Called by the system when a non-missing target is removed, after updating the graphic map. |
Methods inherited from class gumbo.graphic.input.AbstractKeyboardSensor |
addKeyboardTarget, getGraphicMap, getKeyboardCharOut, getKeyboardKeysOut, getKeyState, isKeyRepeat, removeKeyboardTarget |
Methods inherited from class gumbo.util.AbstractDisposable |
dispose, isDisposed |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface gumbo.util.Disposable |
dispose, isDisposed |
Constructor Detail |
public SwingKeyboardSensor()
public SwingKeyboardSensor(boolean keyRepeat)
keyRepeat
- If false, a key out event is sent only if its data
value changes. Does not affect character out.Method Detail |
public CollectionField.EventIn getKeyboardFocusKeysIn()
public BooleanField.EventIn getKeyboardPickActiveIn()
protected void addedSensorTarget(SpaceNode target)
addedSensorTarget
in class AbstractKeyboardSensor
target
- Reference to the target. Never null.protected void removedSensorTarget(SpaceNode target)
AbstractKeyboardSensor
removedSensorTarget
in class AbstractKeyboardSensor
target
- Reference to the target. Never null.public BooleanField.EventIn getKeyboardEnableIn()
KeyboardSensor
public SpaceNodeField.EventIn getKeyboardFocusIn()
KeyboardSensor
public SpaceNodeField.EventOut getKeyboardSpaceOut()
KeyboardSensor
public BooleanField.EventOut getKeyboardActiveOut()
KeyboardSensor
protected void implDispose()
AbstractDisposable
implDispose
in class AbstractDisposable
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |