Package org.openstreetmap.josm.gui.util
Class RedirectInputMap
- java.lang.Object
-
- javax.swing.InputMap
-
- javax.swing.ComponentInputMap
-
- org.openstreetmap.josm.gui.util.RedirectInputMap
-
- All Implemented Interfaces:
Serializable
public class RedirectInputMap extends ComponentInputMap
Make shortcuts from main window work in dialog windows. It's not possible to simply set component input map parent to be Main.contentPane.getInputMap because there is check in setParent that InputMap is for the same component. Yes, this is a hack. Another possibility would be simply copy InputMap, but that would require to keep copies synchronized when some shortcuts are changed later.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description RedirectInputMap(JComponent component, InputMap target)
Create a newRedirectInputMap
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description KeyStroke[]
allKeys()
void
clear()
Object
get(KeyStroke keyStroke)
KeyStroke[]
keys()
void
put(KeyStroke keyStroke, Object actionMapKey)
static void
redirect(JComponent source, JComponent target)
Redirects the key inputs from one component to an other componentvoid
remove(KeyStroke key)
int
size()
-
Methods inherited from class javax.swing.ComponentInputMap
getComponent, setParent
-
-
-
-
Constructor Detail
-
RedirectInputMap
public RedirectInputMap(JComponent component, InputMap target)
Create a newRedirectInputMap
- Parameters:
component
- The component the input map will be added totarget
- The target input map that should be mirrored.
-
-
Method Detail
-
put
public void put(KeyStroke keyStroke, Object actionMapKey)
- Overrides:
put
in classComponentInputMap
-
remove
public void remove(KeyStroke key)
- Overrides:
remove
in classComponentInputMap
-
clear
public void clear()
- Overrides:
clear
in classComponentInputMap
-
redirect
public static void redirect(JComponent source, JComponent target)
Redirects the key inputs from one component to an other component- Parameters:
source
- The source componenttarget
- The target component to send the keystrokes to.
-
-