Changeset 2529 in josm for trunk/src/org


Ignore:
Timestamp:
2009-11-28T13:22:02+01:00 (15 years ago)
Author:
Gubaer
Message:

fixed #3810: Pressing Enter in download dialog doesn't initiate download anymore
If focus is on either of the three checkboxes in the download dialog, pressing ENTER now triggers the download action.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/download/DownloadDialog.java

    r2512 r2529  
    22package org.openstreetmap.josm.gui.download;
    33
     4import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
    45import static org.openstreetmap.josm.tools.I18n.tr;
    56
     
    4546import org.openstreetmap.josm.tools.OsmUrlToBounds;
    4647import org.openstreetmap.josm.tools.WindowGeometry;
    47 import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
    4848
    4949/**
     
    6262     */
    6363    static public DownloadDialog getInstance() {
    64         if (instance == null)
     64        if (instance == null) {
    6565            instance = new DownloadDialog(Main.parent);
     66        }
    6667        return instance;
    6768    }
     
    7980    private DownloadAction actDownload;
    8081    private SideButton btnDownload;
     82
     83    private void makeCheckBoxRespondToEnter(JCheckBox cb) {
     84        cb.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,0), "doDownload");
     85        cb.getActionMap().put("doDownload", actDownload);
     86    }
    8187
    8288    public JPanel buildMainPanel() {
     
    140146        btnDownload.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,0), "download");
    141147        btnDownload.getActionMap().put("download",actDownload);
     148        makeCheckBoxRespondToEnter(cbDownloadGpxData);
     149        makeCheckBoxRespondToEnter(cbDownloadOsmData);
     150        makeCheckBoxRespondToEnter(cbNewLayer);
    142151
    143152        // -- cancel button
     
    307316                    mv.getLatLon(0, mv.getHeight()),
    308317                    mv.getLatLon(mv.getWidth(), 0)
    309                     );
     318            );
    310319            boundingBoxChanged(currentBounds,null);
    311320        }
     
    398407                        tr("<html>Neither <strong>{0}</strong> nor <strong>{1}</strong> is enabled.<br>"
    399408                                + "Please chose to either download OSM data, or GPX data, or both.</html>",
    400                         cbDownloadOsmData.getText(),
    401                         cbDownloadGpxData.getText()
     409                                cbDownloadOsmData.getText(),
     410                                cbDownloadGpxData.getText()
    402411                        ),
    403412                        tr("Error"),
Note: See TracChangeset for help on using the changeset viewer.