javax.swing
Class ComponentInputMap

java.lang.Object
  extended by javax.swing.InputMap
      extended by javax.swing.ComponentInputMap
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
ComponentInputMapUIResource

public class ComponentInputMap
extends InputMap

An InputMap that is associated with a particular JComponent. The component is notified when its ComponentInputMap changes.

See Also:
Serialized Form

Constructor Summary
ComponentInputMap(JComponent comp)
          Creates ComponentInputMap object that notifies the given component about changes to it.
 
Method Summary
 void clear()
          Clears the InputMap.
 JComponent getComponent()
          Returns the component to notify about changes.
 void put(KeyStroke keystroke, Object value)
          Puts a new entry into the InputMap.
 void remove(KeyStroke keystroke)
          Remove an entry from the InputMap.
 void setParent(InputMap parentMap)
          Sets a parent for this ComponentInputMap.
 
Methods inherited from class javax.swing.InputMap
allKeys, get, getParent, keys, size
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ComponentInputMap

public ComponentInputMap(JComponent comp)
Creates ComponentInputMap object that notifies the given component about changes to it.

Parameters:
comp - the component to notify
Throws:
IllegalArgumentException - if comp is null
Method Detail

put

public void put(KeyStroke keystroke,
                Object value)
Puts a new entry into the InputMap. If actionMapKey is null an existing entry will be removed.

Overrides:
put in class InputMap
Parameters:
keystroke - the keystroke for the entry
value - the action.

clear

public void clear()
Clears the InputMap.

Overrides:
clear in class InputMap

remove

public void remove(KeyStroke keystroke)
Remove an entry from the InputMap.

Overrides:
remove in class InputMap
Parameters:
keystroke - the key of the entry to remove

setParent

public void setParent(InputMap parentMap)
Sets a parent for this ComponentInputMap.

Overrides:
setParent in class InputMap
Parameters:
parentMap - the new parent
Throws:
IllegalArgumentException - if parentMap is not a ComponentInputMap or not associated with the same component
See Also:
InputMap.getParent()

getComponent

public JComponent getComponent()
Returns the component to notify about changes.

Returns:
a JComponent object