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:
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
Fields Modifier and Type Field Description private javax.swing.InputMap
target
-
Constructor Summary
Constructors Constructor Description RedirectInputMap(javax.swing.JComponent component, javax.swing.InputMap target)
Create a newRedirectInputMap
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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)
Redirects the key inputs from one component to an other componentvoid
remove(javax.swing.KeyStroke key)
int
size()
-
-
-
Field Detail
-
target
private final javax.swing.InputMap target
-
-
Constructor Detail
-
RedirectInputMap
public RedirectInputMap(javax.swing.JComponent component, javax.swing.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
-
get
public java.lang.Object get(javax.swing.KeyStroke keyStroke)
- Overrides:
get
in classjavax.swing.InputMap
-
keys
public javax.swing.KeyStroke[] keys()
- Overrides:
keys
in classjavax.swing.InputMap
-
size
public int size()
- Overrides:
size
in classjavax.swing.InputMap
-
allKeys
public javax.swing.KeyStroke[] allKeys()
- Overrides:
allKeys
in classjavax.swing.InputMap
-
put
public void put(javax.swing.KeyStroke keyStroke, java.lang.Object actionMapKey)
- Overrides:
put
in classjavax.swing.ComponentInputMap
-
remove
public void remove(javax.swing.KeyStroke key)
- Overrides:
remove
in classjavax.swing.ComponentInputMap
-
clear
public void clear()
- Overrides:
clear
in classjavax.swing.ComponentInputMap
-
redirect
public static void redirect(javax.swing.JComponent source, javax.swing.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.
-
-