From 19981259f06a444ceb7837031645bb697c27296b Mon Sep 17 00:00:00 2001 From: Denis Mottet Date: Tue, 29 Mar 2022 22:57:15 +0200 Subject: [PATCH] wait for MAXIMIZED_BOTH to be done --- src/fr/lgi2p/digit/MainWindow.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/fr/lgi2p/digit/MainWindow.java b/src/fr/lgi2p/digit/MainWindow.java index 28da9dd..5b11928 100644 --- a/src/fr/lgi2p/digit/MainWindow.java +++ b/src/fr/lgi2p/digit/MainWindow.java @@ -168,6 +168,13 @@ public void windowClosing(WindowEvent windowEvent) { frame.setExtendedState(JFrame.MAXIMIZED_BOTH); // done AFTER the content is drawn ?? looks better... indeed frame.setVisible(true); + // we have to wait for the window to be maximized... + try { + Thread.sleep(1000); + } catch (InterruptedException ex) { + Thread.currentThread().interrupt(); + } + configuration.calibration.setScreenCalibration(frame); configuration.calibration.toWindow(); } @@ -365,7 +372,6 @@ private void mouseMovedOrDragged(MouseEvent mouseEvent) { X = X - configuration.getFrameInsets().left; Y = Y - configuration.getFrameInsets().top; - // make event relative to center of circle int dx = configuration.getCenterX() - X; int dy = configuration.getCenterY() - Y; @@ -450,7 +456,7 @@ public void keyPressed(KeyEvent keyEvent) { @Override public void keyTyped(KeyEvent keyEvent) { // 2 things to do : forward key pressed to the marker stream + do action - String message = "KeyTyped=" + (int) keyEvent.getKeyChar() + " ASCI=" + keyEvent.getKeyChar() +" "; + String message = "KeyTyped=" + (int) keyEvent.getKeyChar() + " ASCI=" + keyEvent.getKeyChar() + " "; switch (keyEvent.getKeyChar()) { // specific key => perform action + inform @@ -473,9 +479,9 @@ public void keyTyped(KeyEvent keyEvent) { case 'w': if (configuration.getTaskString().equals("circular")) { actionPerformed( - new ActionEvent(this, ActionEvent.ACTION_PERFORMED, "DoToggleDisplayEffectiveTolerance")); + new ActionEvent(this, ActionEvent.ACTION_PERFORMED, "DoToggleDisplayEffectiveTolerance")); } - // default => forward key pressed to the marker stream + // default => forward key pressed to the marker stream default: outputMouse.writeMarker(message); }