Changeset 2347 in josm


Ignore:
Timestamp:
2009-10-29T07:30:49+01:00 (14 years ago)
Author:
Gubaer
Message:

fixed #3802: Buttons dont't react to enter in download dialog

Location:
trunk/src/org/openstreetmap/josm
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/HelpAction.java

    r2323 r2347  
    3535                    c = SwingUtilities.getDeepestComponentAt(c, mouse.x, mouse.y);
    3636                    topic = HelpUtil.getContextSpecificHelpTopic(c);
    37                     System.out.println("topic is:" + topic);
    3837                } else {
    3938                    topic = null;
     
    4241                Point mouse = Main.parent.getMousePosition();
    4342                topic = HelpUtil.getContextSpecificHelpTopic(SwingUtilities.getDeepestComponentAt(Main.parent, mouse.x, mouse.y));
    44                 System.out.println("topic is:" + topic);
    4543            }
    4644            if (topic == null) {
  • trunk/src/org/openstreetmap/josm/gui/download/DownloadDialog.java

    r2346 r2347  
    135135        JPanel pnl = new JPanel();
    136136        pnl.setLayout(new FlowLayout());
    137          
     137       
     138        // -- download button
    138139        pnl.add(btnDownload = new SideButton(actDownload = new DownloadAction()));
    139140        btnDownload.setFocusable(true);
    140141        btnDownload.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,0), "download");
    141142        btnDownload.getActionMap().put("download",actDownload);
    142         pnl.add(new SideButton(new CancelAction()));
    143         pnl.add(new SideButton(new ContextSensitiveHelpAction(ht("/Dialog/DownloadDialog"))));
     143
     144        // -- cancel button         
     145        SideButton btnCancel;
     146        CancelAction actCancel = new CancelAction();
     147        pnl.add(btnCancel = new SideButton(actCancel));
     148        btnCancel.setFocusable(true);
     149        btnCancel.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,0), "enter");
     150        btnCancel.getActionMap().put("enter",actCancel);
     151
     152        // -- cancel on ESC
     153        getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE,0), "cancel");
     154        getRootPane().getActionMap().put("cancel", actCancel);
     155
     156        // -- help button
     157        SideButton btnHelp;
     158        pnl.add(btnHelp = new SideButton(new ContextSensitiveHelpAction(ht("/Dialog/DownloadDialog"))));
     159        btnHelp.setFocusable(true);
     160        btnHelp.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,0), "enter");
     161        btnHelp.getActionMap().put("enter",btnHelp.getAction());
     162       
    144163        return pnl;       
    145164    }
  • trunk/src/org/openstreetmap/josm/gui/help/HelpUtil.java

    r2308 r2347  
    33
    44import java.awt.Component;
    5 import java.awt.event.KeyEvent;
    65import java.util.Locale;
    76
     
    211210     * code. Example: /Dialog/RelationEditor is a relative help topic, /De:Help/Dialog/RelationEditor
    212211     * is not.
    213      *
    214      *
     212     * 
    215213     * @param component the component  the component
    216214     * @param topic the help topic. Set to the default help topic if null.
     
    218216    static public void setHelpContext(JComponent component, String relativeHelpTopic) {
    219217        if (relativeHelpTopic == null) {
    220             relativeHelpTopic = "";
    221         }
    222         component.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_F1,0), "help");
     218            relativeHelpTopic = "/";
     219        }
     220        component.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("F1"), "help");
    223221        component.getActionMap().put("help", Main.main.menu.help);
    224222        component.putClientProperty("help", relativeHelpTopic);
Note: See TracChangeset for help on using the changeset viewer.