SplashScreen class improvements.

This commit is contained in:
MobiusDev
2018-05-01 01:59:29 +00:00
parent 7f0936b945
commit 1e2d226d36
8 changed files with 40 additions and 40 deletions

View File

@@ -49,14 +49,14 @@ public class SplashScreen extends JWindow
ImageIcon imageIcon = new ImageIcon(image); ImageIcon imageIcon = new ImageIcon(image);
setSize(imageIcon.getIconWidth(), imageIcon.getIconHeight()); setSize(imageIcon.getIconWidth(), imageIcon.getIconHeight());
setLocationRelativeTo(null); setLocationRelativeTo(null);
setAlwaysOnTop(true);
setVisible(true); setVisible(true);
// Schedule to dispose. // Schedule to close.
Executors.newScheduledThreadPool(1).schedule(this::dispose, imageIcon.getIconWidth() > 0 ? time : 100, TimeUnit.MILLISECONDS); Executors.newScheduledThreadPool(1).schedule(this::close, imageIcon.getIconWidth() > 0 ? time : 100, TimeUnit.MILLISECONDS);
} }
@Override public void close()
public void dispose()
{ {
setVisible(false); setVisible(false);
if (parentFrame != null) if (parentFrame != null)
@@ -65,9 +65,9 @@ public class SplashScreen extends JWindow
parentFrame.setVisible(true); parentFrame.setVisible(true);
// Focus parent window. // Focus parent window.
parentFrame.toFront(); parentFrame.toFront();
parentFrame.setState(Frame.ICONIFIED);
parentFrame.setState(Frame.NORMAL); parentFrame.setState(Frame.NORMAL);
} }
super.dispose();
} }
@Override @Override

View File

@@ -49,14 +49,14 @@ public class SplashScreen extends JWindow
ImageIcon imageIcon = new ImageIcon(image); ImageIcon imageIcon = new ImageIcon(image);
setSize(imageIcon.getIconWidth(), imageIcon.getIconHeight()); setSize(imageIcon.getIconWidth(), imageIcon.getIconHeight());
setLocationRelativeTo(null); setLocationRelativeTo(null);
setAlwaysOnTop(true);
setVisible(true); setVisible(true);
// Schedule to dispose. // Schedule to close.
Executors.newScheduledThreadPool(1).schedule(this::dispose, imageIcon.getIconWidth() > 0 ? time : 100, TimeUnit.MILLISECONDS); Executors.newScheduledThreadPool(1).schedule(this::close, imageIcon.getIconWidth() > 0 ? time : 100, TimeUnit.MILLISECONDS);
} }
@Override public void close()
public void dispose()
{ {
setVisible(false); setVisible(false);
if (parentFrame != null) if (parentFrame != null)
@@ -65,9 +65,9 @@ public class SplashScreen extends JWindow
parentFrame.setVisible(true); parentFrame.setVisible(true);
// Focus parent window. // Focus parent window.
parentFrame.toFront(); parentFrame.toFront();
parentFrame.setState(Frame.ICONIFIED);
parentFrame.setState(Frame.NORMAL); parentFrame.setState(Frame.NORMAL);
} }
super.dispose();
} }
@Override @Override

View File

@@ -49,14 +49,14 @@ public class SplashScreen extends JWindow
ImageIcon imageIcon = new ImageIcon(image); ImageIcon imageIcon = new ImageIcon(image);
setSize(imageIcon.getIconWidth(), imageIcon.getIconHeight()); setSize(imageIcon.getIconWidth(), imageIcon.getIconHeight());
setLocationRelativeTo(null); setLocationRelativeTo(null);
setAlwaysOnTop(true);
setVisible(true); setVisible(true);
// Schedule to dispose. // Schedule to close.
Executors.newScheduledThreadPool(1).schedule(this::dispose, imageIcon.getIconWidth() > 0 ? time : 100, TimeUnit.MILLISECONDS); Executors.newScheduledThreadPool(1).schedule(this::close, imageIcon.getIconWidth() > 0 ? time : 100, TimeUnit.MILLISECONDS);
} }
@Override public void close()
public void dispose()
{ {
setVisible(false); setVisible(false);
if (parentFrame != null) if (parentFrame != null)
@@ -65,9 +65,9 @@ public class SplashScreen extends JWindow
parentFrame.setVisible(true); parentFrame.setVisible(true);
// Focus parent window. // Focus parent window.
parentFrame.toFront(); parentFrame.toFront();
parentFrame.setState(Frame.ICONIFIED);
parentFrame.setState(Frame.NORMAL); parentFrame.setState(Frame.NORMAL);
} }
super.dispose();
} }
@Override @Override

View File

@@ -49,14 +49,14 @@ public class SplashScreen extends JWindow
ImageIcon imageIcon = new ImageIcon(image); ImageIcon imageIcon = new ImageIcon(image);
setSize(imageIcon.getIconWidth(), imageIcon.getIconHeight()); setSize(imageIcon.getIconWidth(), imageIcon.getIconHeight());
setLocationRelativeTo(null); setLocationRelativeTo(null);
setAlwaysOnTop(true);
setVisible(true); setVisible(true);
// Schedule to dispose. // Schedule to close.
Executors.newScheduledThreadPool(1).schedule(this::dispose, imageIcon.getIconWidth() > 0 ? time : 100, TimeUnit.MILLISECONDS); Executors.newScheduledThreadPool(1).schedule(this::close, imageIcon.getIconWidth() > 0 ? time : 100, TimeUnit.MILLISECONDS);
} }
@Override public void close()
public void dispose()
{ {
setVisible(false); setVisible(false);
if (parentFrame != null) if (parentFrame != null)
@@ -65,9 +65,9 @@ public class SplashScreen extends JWindow
parentFrame.setVisible(true); parentFrame.setVisible(true);
// Focus parent window. // Focus parent window.
parentFrame.toFront(); parentFrame.toFront();
parentFrame.setState(Frame.ICONIFIED);
parentFrame.setState(Frame.NORMAL); parentFrame.setState(Frame.NORMAL);
} }
super.dispose();
} }
@Override @Override

View File

@@ -49,14 +49,14 @@ public class SplashScreen extends JWindow
ImageIcon imageIcon = new ImageIcon(image); ImageIcon imageIcon = new ImageIcon(image);
setSize(imageIcon.getIconWidth(), imageIcon.getIconHeight()); setSize(imageIcon.getIconWidth(), imageIcon.getIconHeight());
setLocationRelativeTo(null); setLocationRelativeTo(null);
setAlwaysOnTop(true);
setVisible(true); setVisible(true);
// Schedule to dispose. // Schedule to close.
Executors.newScheduledThreadPool(1).schedule(this::dispose, imageIcon.getIconWidth() > 0 ? time : 100, TimeUnit.MILLISECONDS); Executors.newScheduledThreadPool(1).schedule(this::close, imageIcon.getIconWidth() > 0 ? time : 100, TimeUnit.MILLISECONDS);
} }
@Override public void close()
public void dispose()
{ {
setVisible(false); setVisible(false);
if (parentFrame != null) if (parentFrame != null)
@@ -65,9 +65,9 @@ public class SplashScreen extends JWindow
parentFrame.setVisible(true); parentFrame.setVisible(true);
// Focus parent window. // Focus parent window.
parentFrame.toFront(); parentFrame.toFront();
parentFrame.setState(Frame.ICONIFIED);
parentFrame.setState(Frame.NORMAL); parentFrame.setState(Frame.NORMAL);
} }
super.dispose();
} }
@Override @Override

View File

@@ -49,14 +49,14 @@ public class SplashScreen extends JWindow
ImageIcon imageIcon = new ImageIcon(image); ImageIcon imageIcon = new ImageIcon(image);
setSize(imageIcon.getIconWidth(), imageIcon.getIconHeight()); setSize(imageIcon.getIconWidth(), imageIcon.getIconHeight());
setLocationRelativeTo(null); setLocationRelativeTo(null);
setAlwaysOnTop(true);
setVisible(true); setVisible(true);
// Schedule to dispose. // Schedule to close.
Executors.newScheduledThreadPool(1).schedule(this::dispose, imageIcon.getIconWidth() > 0 ? time : 100, TimeUnit.MILLISECONDS); Executors.newScheduledThreadPool(1).schedule(this::close, imageIcon.getIconWidth() > 0 ? time : 100, TimeUnit.MILLISECONDS);
} }
@Override public void close()
public void dispose()
{ {
setVisible(false); setVisible(false);
if (parentFrame != null) if (parentFrame != null)
@@ -65,9 +65,9 @@ public class SplashScreen extends JWindow
parentFrame.setVisible(true); parentFrame.setVisible(true);
// Focus parent window. // Focus parent window.
parentFrame.toFront(); parentFrame.toFront();
parentFrame.setState(Frame.ICONIFIED);
parentFrame.setState(Frame.NORMAL); parentFrame.setState(Frame.NORMAL);
} }
super.dispose();
} }
@Override @Override

View File

@@ -49,14 +49,14 @@ public class SplashScreen extends JWindow
ImageIcon imageIcon = new ImageIcon(image); ImageIcon imageIcon = new ImageIcon(image);
setSize(imageIcon.getIconWidth(), imageIcon.getIconHeight()); setSize(imageIcon.getIconWidth(), imageIcon.getIconHeight());
setLocationRelativeTo(null); setLocationRelativeTo(null);
setAlwaysOnTop(true);
setVisible(true); setVisible(true);
// Schedule to dispose. // Schedule to close.
Executors.newScheduledThreadPool(1).schedule(this::dispose, imageIcon.getIconWidth() > 0 ? time : 100, TimeUnit.MILLISECONDS); Executors.newScheduledThreadPool(1).schedule(this::close, imageIcon.getIconWidth() > 0 ? time : 100, TimeUnit.MILLISECONDS);
} }
@Override public void close()
public void dispose()
{ {
setVisible(false); setVisible(false);
if (parentFrame != null) if (parentFrame != null)
@@ -65,9 +65,9 @@ public class SplashScreen extends JWindow
parentFrame.setVisible(true); parentFrame.setVisible(true);
// Focus parent window. // Focus parent window.
parentFrame.toFront(); parentFrame.toFront();
parentFrame.setState(Frame.ICONIFIED);
parentFrame.setState(Frame.NORMAL); parentFrame.setState(Frame.NORMAL);
} }
super.dispose();
} }
@Override @Override

View File

@@ -49,14 +49,14 @@ public class SplashScreen extends JWindow
ImageIcon imageIcon = new ImageIcon(image); ImageIcon imageIcon = new ImageIcon(image);
setSize(imageIcon.getIconWidth(), imageIcon.getIconHeight()); setSize(imageIcon.getIconWidth(), imageIcon.getIconHeight());
setLocationRelativeTo(null); setLocationRelativeTo(null);
setAlwaysOnTop(true);
setVisible(true); setVisible(true);
// Schedule to dispose. // Schedule to close.
Executors.newScheduledThreadPool(1).schedule(this::dispose, imageIcon.getIconWidth() > 0 ? time : 100, TimeUnit.MILLISECONDS); Executors.newScheduledThreadPool(1).schedule(this::close, imageIcon.getIconWidth() > 0 ? time : 100, TimeUnit.MILLISECONDS);
} }
@Override public void close()
public void dispose()
{ {
setVisible(false); setVisible(false);
if (parentFrame != null) if (parentFrame != null)
@@ -65,9 +65,9 @@ public class SplashScreen extends JWindow
parentFrame.setVisible(true); parentFrame.setVisible(true);
// Focus parent window. // Focus parent window.
parentFrame.toFront(); parentFrame.toFront();
parentFrame.setState(Frame.ICONIFIED);
parentFrame.setState(Frame.NORMAL); parentFrame.setState(Frame.NORMAL);
} }
super.dispose();
} }
@Override @Override