keyboard: let ESCAPE be used to close New City dialog

git-svn-id: https://micropolis.googlecode.com/svn/trunk/micropolis-java@774 d9718cc8-9f43-0410-858b-315f434eb58c
This commit is contained in:
jason@long.name 2013-07-25 20:48:01 +00:00
parent 0465be13c1
commit bbb48f4e91

View file

@ -126,6 +126,12 @@ public class NewCityDialog extends JDialog
pack();
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
setLocationRelativeTo(owner);
getRootPane().registerKeyboardAction(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
dispose();
}},
KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0),
JComponent.WHEN_IN_FOCUSED_WINDOW);
}
private void onPreviousMapClicked()