SplashScreen class improvements.
This commit is contained in:
@@ -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
|
||||||
|
@@ -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
|
||||||
|
@@ -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
|
||||||
|
@@ -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
|
||||||
|
@@ -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
|
||||||
|
@@ -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
|
||||||
|
@@ -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
|
||||||
|
@@ -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
|
||||||
|
Reference in New Issue
Block a user