Changeset 12531 in josm
- Timestamp:
- 2017-07-29T07:26:50+02:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/io/UploadDialog.java
r12452 r12531 12 12 import java.awt.GridBagLayout; 13 13 import java.awt.event.ActionEvent; 14 import java.awt.event.InputEvent; 15 import java.awt.event.KeyEvent; 14 16 import java.awt.event.WindowAdapter; 15 17 import java.awt.event.WindowEvent; … … 29 31 30 32 import javax.swing.AbstractAction; 33 import javax.swing.Action; 31 34 import javax.swing.BorderFactory; 32 35 import javax.swing.Icon; 33 36 import javax.swing.JButton; 37 import javax.swing.JComponent; 34 38 import javax.swing.JOptionPane; 35 39 import javax.swing.JPanel; 36 40 import javax.swing.JTabbedPane; 41 import javax.swing.KeyStroke; 37 42 38 43 import org.openstreetmap.josm.Main; … … 178 183 btnUpload.setFocusable(true); 179 184 InputMapUtils.enableEnter(btnUpload); 185 bindCtrlEnterToAction(getRootPane(), btnUpload.getAction()); 180 186 181 187 // -- cancel button … … 476 482 } 477 483 478 ExtendedDialog dlg = new ExtendedDialog((Component) dialog, title, buttonTexts); 484 ExtendedDialog dlg = new ExtendedDialog((Component) dialog, title, buttonTexts) { 485 @Override 486 public void setupDialog() { 487 super.setupDialog(); 488 bindCtrlEnterToAction(getRootPane(), buttons.get(buttons.size() - 1).getAction()); 489 } 490 }; 479 491 dlg.setContent("<html>" + message + "</html>"); 480 492 dlg.setButtonIcons(buttonIcons); … … 685 697 tpConfigPanels.setSelectedIndex(0); 686 698 } 699 700 private static void bindCtrlEnterToAction(JComponent component, Action actionToBind) { 701 final KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, InputEvent.CTRL_DOWN_MASK); 702 component.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(stroke, "ctrl_enter"); 703 component.getActionMap().put("ctrl_enter", actionToBind); 704 } 687 705 }
Note:
See TracChangeset
for help on using the changeset viewer.