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:
parent
0465be13c1
commit
bbb48f4e91
1 changed files with 6 additions and 0 deletions
|
@ -126,6 +126,12 @@ public class NewCityDialog extends JDialog
|
||||||
pack();
|
pack();
|
||||||
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
||||||
setLocationRelativeTo(owner);
|
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()
|
private void onPreviousMapClicked()
|
||||||
|
|
Reference in a new issue