javax.swing
Class ComponentInputMap
- 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
All Methods Instance Methods Concrete 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.
-
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2022, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.