Skip to content

Commit

Permalink
Move method
Browse files Browse the repository at this point in the history
  • Loading branch information
RetGal committed Jan 5, 2025
1 parent a1b8575 commit a9e02e5
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions src/main/java/mpo/dayon/assisted/gui/Assisted.java
Original file line number Diff line number Diff line change
Expand Up @@ -333,25 +333,6 @@ private static NetworkAssistedEngineConfiguration extractConfiguration(String co
return null;
}

private void capsOff() {
if (Toolkit.getDefaultToolkit().getLockingKeyState(VK_CAPS_LOCK)) {
Log.info("Caps Lock is on, turning it off");
try {
Toolkit.getDefaultToolkit().setLockingKeyState(VK_CAPS_LOCK, false);
} catch (UnsupportedOperationException e) {
final Robot robot;
try {
robot = new Robot();
} catch (AWTException ex) {
throw new IllegalStateException("Could not initialize the AWT robot!", ex);
}
robot.keyPress(VK_CAPS_LOCK);
robot.delay(10);
robot.keyRelease(VK_CAPS_LOCK);
}
}
}

@Override
public void lostOwnership(Clipboard clipboard, Transferable transferable) {
Log.debug("Lost clipboard ownership");
Expand Down Expand Up @@ -479,5 +460,24 @@ public void onIOError(IOException error) {
stop(getNetworkConfiguration().getServerName());
frame.onDisconnecting();
}

private void capsOff() {
if (Toolkit.getDefaultToolkit().getLockingKeyState(VK_CAPS_LOCK)) {
Log.info("Caps Lock is on, turning it off");
try {
Toolkit.getDefaultToolkit().setLockingKeyState(VK_CAPS_LOCK, false);
} catch (UnsupportedOperationException e) {
final Robot robot;
try {
robot = new Robot();
} catch (AWTException ex) {
throw new IllegalStateException("Could not initialize the AWT robot!", ex);
}
robot.keyPress(VK_CAPS_LOCK);
robot.delay(10);
robot.keyRelease(VK_CAPS_LOCK);
}
}
}
}
}

0 comments on commit a9e02e5

Please sign in to comment.