summaryrefslogtreecommitdiffstats
path: root/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LoginWindow.java
diff options
context:
space:
mode:
authorJonathan Bauer2016-10-20 17:51:13 +0200
committerJonathan Bauer2016-10-20 17:51:13 +0200
commit9cfe8b8968b953d07c5520dfc04f5d5c241bb729 (patch)
treee7f94ed02f947e72012cf3243b57ed383581d8ad /dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LoginWindow.java
parent[client] reworked the logic of forcing custom sat selections (diff)
downloadtutor-module-9cfe8b8968b953d07c5520dfc04f5d5c241bb729.tar.gz
tutor-module-9cfe8b8968b953d07c5520dfc04f5d5c241bb729.tar.xz
tutor-module-9cfe8b8968b953d07c5520dfc04f5d5c241bb729.zip
[client] improved shift handling for custom sat on login
Diffstat (limited to 'dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LoginWindow.java')
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LoginWindow.java27
1 files changed, 3 insertions, 24 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LoginWindow.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LoginWindow.java
index e42406b0..63bf557a 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LoginWindow.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LoginWindow.java
@@ -79,24 +79,6 @@ public class LoginWindow extends LoginWindowLayout {
private boolean forceCustomSatellite = false;
- private final KeyEventDispatcher satelliteShiftDispatcher = new KeyEventDispatcher() {
- @Override
- public boolean dispatchKeyEvent(KeyEvent event) {
- int code = event.getKeyCode();
- if (code == KeyEvent.VK_SHIFT) { // shift key is pressed
- int type = event.getID();
- if (type == KeyEvent.KEY_PRESSED) {
- forceCustomSatellite = true;
- event.consume();
- } else if (type == KeyEvent.KEY_RELEASED) {
- forceCustomSatellite = false;
- event.consume();
- }
- }
- return event.isConsumed();
- }
- };
-
public LoginWindow(Frame modalParent) {
// call the constructor of the superclass
super(modalParent);
@@ -175,11 +157,12 @@ public class LoginWindow extends LoginWindowLayout {
}
});
- KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(satelliteShiftDispatcher);
-
btnLogin.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
+ int mods = e.getModifiers();
+ // evaluate if SHIFT was hold during the click
+ forceCustomSatellite = ((mods & ActionEvent.SHIFT_MASK) == ActionEvent.SHIFT_MASK);
doLogin();
}
});
@@ -444,10 +427,6 @@ public class LoginWindow extends LoginWindowLayout {
Config.saveCurrentSession(Session.getSatelliteAddress(), Session.getSatelliteToken(),
Session.getMasterToken());
}
- // Remove the listener for the shift key. (For forcing the satellite selection)
- KeyboardFocusManager.getCurrentKeyboardFocusManager().removeKeyEventDispatcher(
- satelliteShiftDispatcher);
-
dispose();
return;
}