summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Bauer2019-04-04 16:30:57 +0200
committerJonathan Bauer2019-04-04 16:30:57 +0200
commite2a76ea01fa041c7150a746b288149ab671782c7 (patch)
treeeb201ce26b3be0c15319b0fdab24cd7e799a49ee
parent[client] netrules: layout (diff)
downloadtutor-module-e2a76ea01fa041c7150a746b288149ab671782c7.tar.gz
tutor-module-e2a76ea01fa041c7150a746b288149ab671782c7.tar.xz
tutor-module-e2a76ea01fa041c7150a746b288149ab671782c7.zip
[client] startup: close with ESC
in a non-deprecated way
-rwxr-xr-xdozentenmodul/src/main/java/org/openslx/dozmod/gui/configurator/StartupConfigurator.java9
1 files changed, 6 insertions, 3 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/configurator/StartupConfigurator.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/configurator/StartupConfigurator.java
index 5283baf4..16267690 100755
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/configurator/StartupConfigurator.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/configurator/StartupConfigurator.java
@@ -15,6 +15,7 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.atomic.AtomicReference;
+import javax.swing.AbstractAction;
import javax.swing.Box;
import javax.swing.ButtonModel;
import javax.swing.DefaultComboBoxModel;
@@ -101,13 +102,15 @@ public class StartupConfigurator extends StartupConfiguratorLayout {
final JDialog dialog = new JDialog(SwingUtilities.getWindowAncestor(this),
"Auswahl", ModalityType.APPLICATION_MODAL);
JPanel pane = new JPanel();
- pane.setBorder(new EmptyBorder(new Insets(10, 5, 5, 10)));
- pane.registerKeyboardAction(new ActionListener() {
+ pane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW)
+ .put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "cancel");
+ pane.getActionMap().put("cancel", new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
dialog.dispose();
}
- }, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_IN_FOCUSED_WINDOW);
+ });
+ pane.setBorder(new EmptyBorder(new Insets(10, 5, 5, 10)));
dialog.setContentPane(pane);
Dimension dd = Gui.getScaledDimension(300, 250 + 15 * scripts.size());
dialog.setMinimumSize(dd);