Skip to content

Commit

Permalink
Close block dialog when ESC key is pressed
Browse files Browse the repository at this point in the history
fixes #316
  • Loading branch information
t-sommer committed Oct 25, 2021
1 parent 3035ed6 commit a7b831e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Java/src/main/java/fmikit/ui/FMUBlockDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,13 @@ public void windowClosing(WindowEvent e) {
});

// call onCancel() on ESCAPE
contentPane.registerKeyboardAction(new ActionListener() {
getRootPane().registerKeyboardAction(new ActionListener() {

public void actionPerformed(ActionEvent e) {
dispose();
}

}, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
}, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_IN_FOCUSED_WINDOW);

// TODO: center the window on screen
setBounds(200, 200, 852, 619);
Expand Down

0 comments on commit a7b831e

Please sign in to comment.