vlsi commented on pull request #610:
URL: https://github.com/apache/jmeter/pull/610#issuecomment-676594072
> I fear, that it can come up behind the main window and irritate people, as
JMeter will seem to stop being responsive until the (possibly hidden?) splash
screen is removed.
That is valid.
It looks like `JDialog` + `ModalityType.APPLICATION_MODAL` + `undecorated`
nails it.
The result looks like "splash screen is always above JMeter window. The main
window is **unclickable** as long as the splash is there, and the splash does
not block other apps.
```diff
--- a/src/core/src/main/java/org/apache/jmeter/SplashScreen.java
+++ b/src/core/src/main/java/org/apache/jmeter/SplashScreen.java
@@ -18,15 +18,16 @@
package org.apache.jmeter;
import java.awt.BorderLayout;
+import java.awt.Frame;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import javax.swing.Icon;
import javax.swing.JComponent;
+import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JProgressBar;
-import javax.swing.JWindow;
import javax.swing.SwingUtilities;
import javax.swing.border.EmptyBorder;
@@ -40,7 +41,7 @@ import com.github.weisj.darklaf.icons.ThemedSVGIcon;
* Splash Screen
* @since 3.2
*/
-public class SplashScreen extends JWindow {
+public class SplashScreen extends JDialog {
private static final Logger log =
LoggerFactory.getLogger(SplashScreen.class);
private static final long serialVersionUID = 1L;
@@ -53,6 +54,9 @@ public class SplashScreen extends JWindow {
setLayout(new BorderLayout());
add(loadLogo(), BorderLayout.CENTER);
add(progressBar, BorderLayout.SOUTH);
+ setModalityType(ModalityType.APPLICATION_MODAL);
+ setAutoRequestFocus(true);
+ setUndecorated(true);
pack();
setLocationRelativeTo(null);
}
@@ -91,7 +95,6 @@ public class SplashScreen extends JWindow {
public void showScreen() {
SwingUtilities.invokeLater(() -> {
setVisible(true);
- setAlwaysOnTop(true);
});
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]