- java.lang.Object
-
- javax.swing.InputMap
-
- javax.swing.ComponentInputMap
-
- All Implemented Interfaces:
- Serializable
- Direct Known Subclasses:
- ComponentInputMapUIResource
public class ComponentInputMap extends InputMap
AComponentInputMap
is anInputMap
associated with a particularJComponent
. The component is automatically notified whenever theComponentInputMap
changes.ComponentInputMap
s are used forWHEN_IN_FOCUSED_WINDOW
bindings.- Since:
- 1.3
-
-
Constructor Summary
Constructors Constructor and Description ComponentInputMap(JComponent component)
Creates aComponentInputMap
associated with the specified component.
-
Method Summary
Methods Modifier and Type Method and Description void
clear()
Removes all the mappings from this object.JComponent
getComponent()
Returns the component theInputMap
was created for.void
put(KeyStroke keyStroke, Object actionMapKey)
Adds a binding forkeyStroke
toactionMapKey
.void
remove(KeyStroke key)
Removes the binding forkey
from this object.void
setParent(InputMap map)
Sets the parent, which must be aComponentInputMap
associated with the same component as thisComponentInputMap
.
-
-
-
Constructor Detail
-
ComponentInputMap
public ComponentInputMap(JComponent component)
Creates aComponentInputMap
associated with the specified component.- Parameters:
component
- a non-nullJComponent
- Throws:
IllegalArgumentException
- ifcomponent
is null
-
-
Method Detail
-
setParent
public void setParent(InputMap map)
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
public JComponent getComponent()
Returns the component theInputMap
was created for.
-
put
public void put(KeyStroke keyStroke, Object actionMapKey)
Adds a binding forkeyStroke
toactionMapKey
. IfactionMapKey
is null, this removes the current binding forkeyStroke
.
-
remove
public void remove(KeyStroke key)
Removes the binding forkey
from this object.
-
-
Document created the 11/06/2005, last modified the 04/03/2020
Source of the printed document:https://www.gaudry.be/en/java-api-rf-javax/swing/componentinputmap.html
The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.
References
These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.