Changeset 4297 in josm for trunk


Ignore:
Timestamp:
2011-08-08T00:18:01+02:00 (13 years ago)
Author:
stoecker
Message:

fix #6668 - patch by simon04 - Close HistoryBrowserDialog with Escape

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowserDialog.java

    r3768 r4297  
    99import java.awt.FlowLayout;
    1010import java.awt.event.ActionEvent;
     11import java.awt.event.KeyEvent;
    1112import java.awt.event.WindowAdapter;
    1213import java.awt.event.WindowEvent;
    1314
    1415import javax.swing.AbstractAction;
     16import javax.swing.JComponent;
    1517import javax.swing.JDialog;
    1618import javax.swing.JOptionPane;
    1719import javax.swing.JPanel;
     20import javax.swing.KeyStroke;
    1821
    1922import org.openstreetmap.josm.Main;
     
    7376
    7477        btn = new SideButton(closeAction = new CloseAction());
     78        final String closeHistoryBrowserDialogKey = "CloseHistoryBrowserDialog";
     79        KeyStroke escapeKey = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0, false);
     80        getRootPane().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(escapeKey, closeHistoryBrowserDialogKey);
     81        getRootPane().getActionMap().put(closeHistoryBrowserDialogKey, closeAction);
    7582        btn.setName("btn.close");
    7683        pnl.add(btn);
Note: See TracChangeset for help on using the changeset viewer.