diff --git a/src/java/davmail/ui/AcceptCertificateDialog.java b/src/java/davmail/ui/AcceptCertificateDialog.java index 457c16d6..0c3c6acb 100644 --- a/src/java/davmail/ui/AcceptCertificateDialog.java +++ b/src/java/davmail/ui/AcceptCertificateDialog.java @@ -117,6 +117,8 @@ public class AcceptCertificateDialog extends JDialog { getToolkit().getScreenSize().height / 2 - getSize().height / 2); setVisible(true); + toFront(); + requestFocus(); } protected JPanel getButtonPanel() { diff --git a/src/java/davmail/ui/NotificationDialog.java b/src/java/davmail/ui/NotificationDialog.java index 8c7801f2..e5994faa 100644 --- a/src/java/davmail/ui/NotificationDialog.java +++ b/src/java/davmail/ui/NotificationDialog.java @@ -134,6 +134,7 @@ public class NotificationDialog extends JDialog { getSize().height / 2); bodyField.requestFocus(); setVisible(true); + toFront(); requestFocus(); } diff --git a/src/java/davmail/ui/PasswordPromptDialog.java b/src/java/davmail/ui/PasswordPromptDialog.java index 3cb60450..2e0be032 100644 --- a/src/java/davmail/ui/PasswordPromptDialog.java +++ b/src/java/davmail/ui/PasswordPromptDialog.java @@ -92,6 +92,7 @@ public class PasswordPromptDialog extends JDialog { getToolkit().getScreenSize().height / 2 - getSize().height / 2); setVisible(true); + toFront(); requestFocus(); } diff --git a/src/java/davmail/ui/SelectCertificateDialog.java b/src/java/davmail/ui/SelectCertificateDialog.java index 6cec5151..c28c5ba8 100644 --- a/src/java/davmail/ui/SelectCertificateDialog.java +++ b/src/java/davmail/ui/SelectCertificateDialog.java @@ -83,6 +83,7 @@ public class SelectCertificateDialog extends JDialog { getToolkit().getScreenSize().height / 2 - getSize().height / 2); setVisible(true); + toFront(); requestFocus(); } diff --git a/src/java/davmail/ui/tray/AwtGatewayTray.java b/src/java/davmail/ui/tray/AwtGatewayTray.java index cf105124..a0303da7 100644 --- a/src/java/davmail/ui/tray/AwtGatewayTray.java +++ b/src/java/davmail/ui/tray/AwtGatewayTray.java @@ -148,6 +148,8 @@ public class AwtGatewayTray implements DavGatewayTrayInterface { public void run() { aboutFrame.update(); aboutFrame.setVisible(true); + aboutFrame.toFront(); + aboutFrame.requestFocus(); } }); } @@ -160,6 +162,8 @@ public class AwtGatewayTray implements DavGatewayTrayInterface { public void run() { settingsFrame.reload(); settingsFrame.setVisible(true); + settingsFrame.toFront(); + settingsFrame.requestFocus(); } }); } @@ -273,6 +277,8 @@ public class AwtGatewayTray implements DavGatewayTrayInterface { // display settings frame on first start if (Settings.isFirstStart()) { settingsFrame.setVisible(true); + settingsFrame.toFront(); + settingsFrame.requestFocus(); } } diff --git a/src/java/davmail/ui/tray/FrameGatewayTray.java b/src/java/davmail/ui/tray/FrameGatewayTray.java index e421f32a..1f2f19f9 100644 --- a/src/java/davmail/ui/tray/FrameGatewayTray.java +++ b/src/java/davmail/ui/tray/FrameGatewayTray.java @@ -144,6 +144,8 @@ public class FrameGatewayTray implements DavGatewayTrayInterface { public void run() { aboutFrame.update(); aboutFrame.setVisible(true); + aboutFrame.toFront(); + aboutFrame.requestFocus(); } }); } @@ -156,6 +158,8 @@ public class FrameGatewayTray implements DavGatewayTrayInterface { public void run() { settingsFrame.reload(); settingsFrame.setVisible(true); + settingsFrame.toFront(); + settingsFrame.requestFocus(); } }); } @@ -312,6 +316,8 @@ public class FrameGatewayTray implements DavGatewayTrayInterface { // display settings frame on first start if (Settings.isFirstStart()) { settingsFrame.setVisible(true); + settingsFrame.toFront(); + settingsFrame.requestFocus(); } } } diff --git a/src/java/davmail/ui/tray/SwtGatewayTray.java b/src/java/davmail/ui/tray/SwtGatewayTray.java index 14e281c0..09b9d9ee 100644 --- a/src/java/davmail/ui/tray/SwtGatewayTray.java +++ b/src/java/davmail/ui/tray/SwtGatewayTray.java @@ -234,6 +234,8 @@ public class SwtGatewayTray implements DavGatewayTrayInterface { } aboutFrame.update(); aboutFrame.setVisible(true); + aboutFrame.toFront(); + aboutFrame.requestFocus(); } }); } @@ -250,8 +252,8 @@ public class SwtGatewayTray implements DavGatewayTrayInterface { } settingsFrame.reload(); settingsFrame.setVisible(true); - // workaround for focus on first open - settingsFrame.setVisible(true); + settingsFrame.toFront(); + settingsFrame.requestFocus(); } }); } @@ -271,8 +273,8 @@ public class SwtGatewayTray implements DavGatewayTrayInterface { } settingsFrame.reload(); settingsFrame.setVisible(true); - // workaround for focus on first open - settingsFrame.setVisible(true); + settingsFrame.toFront(); + settingsFrame.requestFocus(); } }); } @@ -321,6 +323,8 @@ public class SwtGatewayTray implements DavGatewayTrayInterface { settingsFrame = new SettingsFrame(); } settingsFrame.setVisible(true); + settingsFrame.toFront(); + settingsFrame.requestFocus(); } synchronized (mainThread) {