java.lang.Object
javax.swing.InputMap
javax.swing.ComponentInputMap
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
ComponentInputMapUIResource
A
ComponentInputMap
is an InputMap
associated with a particular JComponent
.
The component is automatically notified whenever
the ComponentInputMap
changes.
ComponentInputMap
s are used for
WHEN_IN_FOCUSED_WINDOW
bindings.- Since:
- 1.3
-
Constructor Summary
ConstructorDescriptionComponentInputMap
(JComponent component) Creates aComponentInputMap
associated with the specified component. -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Removes all the mappings from this object.Returns the component theInputMap
was created for.void
Adds a binding forkeyStroke
toactionMapKey
.void
Removes the binding forkey
from this object.void
Sets the parent, which must be aComponentInputMap
associated with the same component as thisComponentInputMap
.
-
Constructor Details
-
ComponentInputMap
Creates aComponentInputMap
associated with the specified component.- Parameters:
component
- a non-nullJComponent
- Throws:
IllegalArgumentException
- ifcomponent
is null
-
-
Method Details
-
setParent
Sets the parent, which must be aComponentInputMap
associated with the same component as thisComponentInputMap
.- Overrides:
setParent
in classInputMap
- Parameters:
map
- aComponentInputMap
- Throws:
IllegalArgumentException
- ifmap
is not aComponentInputMap
or is not associated with the same component
-
getComponent
Returns the component theInputMap
was created for.- Returns:
- the component the
InputMap
was created for.
-
put
Adds a binding forkeyStroke
toactionMapKey
. IfactionMapKey
is null, this removes the current binding forkeyStroke
. -
remove
Removes the binding forkey
from this object. -
clear
public void clear()Removes all the mappings from this object.
-