javax.swing

Class ComponentInputMap

public class ComponentInputMap extends InputMap

An {@link InputMap} that is associated with a particular {@link JComponent}. The component is notified when its ComponentInputMap changes.
Constructor Summary
ComponentInputMap(JComponent comp)
Creates ComponentInputMap object that notifies the given component about changes to it.
Method Summary
voidclear()
Clears the InputMap.
JComponentgetComponent()
Returns the component to notify about changes.
voidput(KeyStroke keystroke, Object value)
Puts a new entry into the InputMap.
voidremove(KeyStroke keystroke)
Remove an entry from the InputMap.
voidsetParent(InputMap parentMap)
Sets a parent for this ComponentInputMap.

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

clear

public void clear()
Clears the InputMap.

getComponent

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

Returns: a JComponent object

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.

Parameters: keystroke the keystroke for the entry value the action.

remove

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

Parameters: keystroke the key of the entry to remove

setParent

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

Parameters: parentMap the new parent

Throws: IllegalArgumentException if parentMap is not a ComponentInputMap or not associated with the same component