Changeset 10791 in josm for trunk/src/org/openstreetmap/josm/tools
- Timestamp:
- 2016-08-12T21:08:00+02:00 (8 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/InputMapUtils.java
r10790 r10791 105 105 c.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0), "spacebar"); 106 106 } 107 108 /** 109 * Add an action activated with ESCAPE key on a component or its children. 110 * @param c The Swing component 111 * @param a action activated with ESCAPE key 112 * @see JComponent#WHEN_ANCESTOR_OF_FOCUSED_COMPONENT 113 * @since 10791 114 */ 115 public static void addEscapeAction(JComponent c, Action a) { 116 c.getActionMap().put("escape", a); 117 c.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "escape"); 118 } 107 119 } -
trunk/src/org/openstreetmap/josm/tools/bugreport/BugReportDialog.java
r10720 r10791 9 9 import java.awt.GridBagLayout; 10 10 import java.awt.event.ActionEvent; 11 import java.awt.event.KeyEvent;12 11 13 12 import javax.swing.AbstractAction; … … 16 15 import javax.swing.JButton; 17 16 import javax.swing.JCheckBox; 18 import javax.swing.JComponent;19 17 import javax.swing.JDialog; 20 18 import javax.swing.JLabel; 21 19 import javax.swing.JPanel; 22 import javax.swing.KeyStroke;23 20 import javax.swing.UIManager; 24 21 … … 29 26 import org.openstreetmap.josm.tools.GBC; 30 27 import org.openstreetmap.josm.tools.ImageProvider; 28 import org.openstreetmap.josm.tools.InputMapUtils; 31 29 32 30 /** … … 72 70 setDefaultCloseOperation(DISPOSE_ON_CLOSE); 73 71 74 getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "escape"); 75 getRootPane().getActionMap().put("escape", new AbstractAction() { 72 InputMapUtils.addEscapeAction(getRootPane(), new AbstractAction() { 76 73 @Override 77 74 public void actionPerformed(ActionEvent e) {
Note:
See TracChangeset
for help on using the changeset viewer.