|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.nite.tools.videolabeler.GlobalInputMap
public class GlobalInputMap
A global input map is a singleton object that consists of an
(@link javax.swing.ActionMap ActionMap} and an
InputMap
. The action map and input map are
set in the desktop pane in the main frame of the application (see
ContinuousVideoLabeling
. The input map
is used under the condition that the desktop pane is the ancestor of the
focused component. Since the desktop pane is the ancestor of all components
in this application (internal frames and their components), the input map
will be used application-wide.
Method Summary | |
---|---|
void |
addKeyStroke(javax.swing.KeyStroke key,
javax.swing.Action action)
Adds a keystroke to the input map. |
java.lang.String |
addKeyStroke(java.lang.String keystroke,
javax.swing.Action action)
Adds a keystroke to the input map. |
javax.swing.ActionMap |
getActionMap()
Returns the action map. |
javax.swing.InputMap |
getInputMap()
Returns the input map. |
static GlobalInputMap |
getInstance()
Returns the singleton global input map. |
void |
removeKeyStroke(javax.swing.KeyStroke key)
Removes a keystroke from the input map and the associated action from the action map. |
void |
removeKeyStroke(java.lang.String keystroke)
Removes a keystroke from the input map and the associated action from the action map. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static GlobalInputMap getInstance()
Returns the singleton global input map.
public javax.swing.ActionMap getActionMap()
Returns the action map. The action map should NOT be edited directly!
public javax.swing.InputMap getInputMap()
Returns the input map. The input map should NOT be edited directly!
public java.lang.String addKeyStroke(java.lang.String keystroke, javax.swing.Action action)
Adds a keystroke to the input map. The keystroke will be mapped to the specified action. In effect the action map will contain a mapping from a unique action name (based on the name set in the action) to the specified action. The input map will contain a mapping from the specified keystroke to the unique action name.
The keystroke must be specified as documented in
KeyStroke.getKeyStroke()
,
but may also be null (see further on).
If the keystroke could not be parsed, or if the input map already
contains a mapping for the same keystroke, this method prints a warning
to standard output. In this case, or if the specified keystroke is null,
this method may automatically make a unique keystroke. This depends on
the GUI setting autokeystrokes
(see
CSLConfig
). If the setting is true, this method will
try to find an unused keystroke for the keys 1 to 0 or A to Z (in that
order).
This method returns the actual keystroke. This may be the same as
the specified keystroke, or a keystroke that was made automatically.
It may also be null. Use the returned keystroke (if not null) to remove
the keystroke later with
removeKeyStroke()
.
keystroke
- a keystroke or nullaction
- the action
public void addKeyStroke(javax.swing.KeyStroke key, javax.swing.Action action)
Adds a keystroke to the input map. The keystroke will be mapped to the specified action. In effect the action map will contain a mapping from a unique action name (based on the name set in the action) to the specified action. The input map will contain a mapping from the specified keystroke to the unique action name.
For this version of the call, the client program must pass an already valid KeyStroke.
To remove the keystroke later use
removeKeyStroke()
.
keystroke
- a keystrokeaction
- the actionpublic void removeKeyStroke(java.lang.String keystroke)
Removes a keystroke from the input map and the associated action from
the action map. This method MUST be called whenever an action is not used
anymore, for instance when an annotation frame is closed. But it should
ONLY be called if the keystroke was successfully added with
addKeyStroke()
.
keystroke
- the keystroke to be removedpublic void removeKeyStroke(javax.swing.KeyStroke key)
Removes a keystroke from the input map and the associated action from
the action map. This method MUST be called whenever an action is not used
anymore, for instance when an annotation frame is closed. But it should
ONLY be called if the keystroke was successfully added with
addKeyStroke()
.
keystroke
- the javax.swing.KeyStroke to be removed
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |