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:
- java.io.Serializable
public class RedirectInputMap
- extends javax.swing.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
Field Summary |
private javax.swing.InputMap |
target
|
Constructor Summary |
RedirectInputMap(javax.swing.JComponent component,
javax.swing.InputMap target)
|
Method Summary |
javax.swing.KeyStroke[] |
allKeys()
|
void |
clear()
|
java.lang.Object |
get(javax.swing.KeyStroke keyStroke)
|
javax.swing.KeyStroke[] |
keys()
|
void |
put(javax.swing.KeyStroke keyStroke,
java.lang.Object actionMapKey)
|
static void |
redirect(javax.swing.JComponent source,
javax.swing.JComponent target)
|
void |
remove(javax.swing.KeyStroke key)
|
int |
size()
|
Methods inherited from class javax.swing.ComponentInputMap |
getComponent, setParent |
Methods inherited from class javax.swing.InputMap |
getParent |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
target
private final javax.swing.InputMap target
RedirectInputMap
public RedirectInputMap(javax.swing.JComponent component,
javax.swing.InputMap target)
get
public java.lang.Object get(javax.swing.KeyStroke keyStroke)
- Overrides:
get
in class javax.swing.InputMap
keys
public javax.swing.KeyStroke[] keys()
- Overrides:
keys
in class javax.swing.InputMap
size
public int size()
- Overrides:
size
in class javax.swing.InputMap
allKeys
public javax.swing.KeyStroke[] allKeys()
- Overrides:
allKeys
in class javax.swing.InputMap
put
public void put(javax.swing.KeyStroke keyStroke,
java.lang.Object actionMapKey)
- Overrides:
put
in class javax.swing.ComponentInputMap
remove
public void remove(javax.swing.KeyStroke key)
- Overrides:
remove
in class javax.swing.ComponentInputMap
clear
public void clear()
- Overrides:
clear
in class javax.swing.ComponentInputMap
redirect
public static void redirect(javax.swing.JComponent source,
javax.swing.JComponent target)
JOSM