[josm-dev] Register for keys/shortcuts
Matthias Meißer
digi_c at arcor.de
Sun May 30 17:35:40 BST 2010
Hi, sry it's me again with this annoying issue :(
Can anybody help me with a good snippet to register Keys as JOSM plugin,
please?
I'm not sure if it is a problem cause I haven't got the focus as layer
or if I use the wrong techniques.
I tried:
Main.panel.addKeyListener(this);
Main.map.mapView.addKeyListener(this);
Main.map.mapView.getRootPane().getGlassPane().addKeyListener(this);
and of course the InputMap approach:
Main.contentPane.getInputMap().put(KeyStroke.getKeyStroke("SPACE"),"pressed");
Main.contentPane.getActionMap().put("pressed",a);
Main.contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_SPACE,0),a);
Main.contentPane.getActionMap().put("doSomething",a);
Sry but I'm realy annoyed cause I can't realise such a cheap feature :-(
nice weekeend
Matthias
More information about the josm-dev
mailing list