BudgetDialog: if ESC is pressed, close the dialog
git-svn-id: https://micropolis.googlecode.com/svn/trunk/micropolis-java@584 d9718cc8-9f43-0410-858b-315f434eb58c
This commit is contained in:
parent
6cfc5ef5ef
commit
8e9cd7d94d
1 changed files with 6 additions and 0 deletions
|
@ -196,6 +196,12 @@ public class BudgetDialog 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 setAutoRequestFocus_compat(boolean v)
|
private void setAutoRequestFocus_compat(boolean v)
|
||||||
|
|
Reference in a new issue