mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-11 01:32:08 +10:00
protect splash screen code
This commit is contained in:
@@ -95,7 +95,7 @@ public class DIYLCSplash extends JDialog {
|
||||
|
||||
private ImageIcon film = null;
|
||||
|
||||
public ImageIcon getFilm() {
|
||||
private ImageIcon getFilm() {
|
||||
if (film == null) {
|
||||
film = (ImageIcon) IconLoader.SplashFilm.getIcon();
|
||||
}
|
||||
@@ -104,7 +104,7 @@ public class DIYLCSplash extends JDialog {
|
||||
|
||||
private ImageIcon ceramic = null;
|
||||
|
||||
public ImageIcon getCeramic() {
|
||||
private ImageIcon getCeramic() {
|
||||
if (ceramic == null) {
|
||||
ceramic = (ImageIcon) IconLoader.SplashCeramic.getIcon();
|
||||
}
|
||||
@@ -113,7 +113,7 @@ public class DIYLCSplash extends JDialog {
|
||||
|
||||
private ImageIcon electrolytic = null;
|
||||
|
||||
public ImageIcon getElectrolytic() {
|
||||
private ImageIcon getElectrolytic() {
|
||||
if (electrolytic == null) {
|
||||
electrolytic = (ImageIcon) IconLoader.SplashElectrolytic.getIcon();
|
||||
}
|
||||
@@ -122,7 +122,7 @@ public class DIYLCSplash extends JDialog {
|
||||
|
||||
private ImageIcon splash = null;
|
||||
|
||||
public ImageIcon getSplash() {
|
||||
private ImageIcon getSplash() {
|
||||
if (splash == null) {
|
||||
splash = (ImageIcon) IconLoader.Splash.getIcon();
|
||||
}
|
||||
|
||||
@@ -59,7 +59,15 @@ public class DIYLCStarter {
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
// Initialize splash screen
|
||||
DIYLCSplash splash = new DIYLCSplash();
|
||||
DIYLCSplash splash = null;
|
||||
Exception splashException = null;
|
||||
|
||||
try {
|
||||
splash = new DIYLCSplash();
|
||||
} catch (Exception e) {
|
||||
System.out.println("Splash screen could not be initialized: " + e.getMessage());
|
||||
splashException = e;
|
||||
}
|
||||
|
||||
URL url = DIYLCStarter.class.getResource("log4j.properties");
|
||||
Properties properties = new Properties();
|
||||
@@ -131,8 +139,12 @@ public class DIYLCStarter {
|
||||
MainFrame mainFrame = new MainFrame();
|
||||
// mainFrame.setLocationRelativeTo(null);
|
||||
|
||||
splash.setVisible(false);
|
||||
splash.dispose();
|
||||
if (splash == null) {
|
||||
LOG.warn("Splash screen could not be initialized", splashException);
|
||||
} else {
|
||||
splash.setVisible(false);
|
||||
splash.dispose();
|
||||
}
|
||||
|
||||
mainFrame.setVisible(true);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user