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.InputMaptarget
-
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()voidclear()java.lang.Objectget(javax.swing.KeyStroke keyStroke)javax.swing.KeyStroke[]keys()voidput(javax.swing.KeyStroke keyStroke, java.lang.Object actionMapKey)static voidredirect(javax.swing.JComponent source, javax.swing.JComponent target)Redirects the key inputs from one component to an other componentvoidremove(javax.swing.KeyStroke key)intsize()
-
-
-
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:
getin classjavax.swing.InputMap
-
keys
public javax.swing.KeyStroke[] keys()
- Overrides:
keysin classjavax.swing.InputMap
-
size
public int size()
- Overrides:
sizein classjavax.swing.InputMap
-
allKeys
public javax.swing.KeyStroke[] allKeys()
- Overrides:
allKeysin classjavax.swing.InputMap
-
put
public void put(javax.swing.KeyStroke keyStroke, java.lang.Object actionMapKey)
- Overrides:
putin classjavax.swing.ComponentInputMap
-
remove
public void remove(javax.swing.KeyStroke key)
- Overrides:
removein classjavax.swing.ComponentInputMap
-
clear
public void clear()
- Overrides:
clearin 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.
-
-