mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-11 09:42: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;
|
private ImageIcon film = null;
|
||||||
|
|
||||||
public ImageIcon getFilm() {
|
private ImageIcon getFilm() {
|
||||||
if (film == null) {
|
if (film == null) {
|
||||||
film = (ImageIcon) IconLoader.SplashFilm.getIcon();
|
film = (ImageIcon) IconLoader.SplashFilm.getIcon();
|
||||||
}
|
}
|
||||||
@@ -104,7 +104,7 @@ public class DIYLCSplash extends JDialog {
|
|||||||
|
|
||||||
private ImageIcon ceramic = null;
|
private ImageIcon ceramic = null;
|
||||||
|
|
||||||
public ImageIcon getCeramic() {
|
private ImageIcon getCeramic() {
|
||||||
if (ceramic == null) {
|
if (ceramic == null) {
|
||||||
ceramic = (ImageIcon) IconLoader.SplashCeramic.getIcon();
|
ceramic = (ImageIcon) IconLoader.SplashCeramic.getIcon();
|
||||||
}
|
}
|
||||||
@@ -113,7 +113,7 @@ public class DIYLCSplash extends JDialog {
|
|||||||
|
|
||||||
private ImageIcon electrolytic = null;
|
private ImageIcon electrolytic = null;
|
||||||
|
|
||||||
public ImageIcon getElectrolytic() {
|
private ImageIcon getElectrolytic() {
|
||||||
if (electrolytic == null) {
|
if (electrolytic == null) {
|
||||||
electrolytic = (ImageIcon) IconLoader.SplashElectrolytic.getIcon();
|
electrolytic = (ImageIcon) IconLoader.SplashElectrolytic.getIcon();
|
||||||
}
|
}
|
||||||
@@ -122,7 +122,7 @@ public class DIYLCSplash extends JDialog {
|
|||||||
|
|
||||||
private ImageIcon splash = null;
|
private ImageIcon splash = null;
|
||||||
|
|
||||||
public ImageIcon getSplash() {
|
private ImageIcon getSplash() {
|
||||||
if (splash == null) {
|
if (splash == null) {
|
||||||
splash = (ImageIcon) IconLoader.Splash.getIcon();
|
splash = (ImageIcon) IconLoader.Splash.getIcon();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,7 +59,15 @@ public class DIYLCStarter {
|
|||||||
*/
|
*/
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
// Initialize splash screen
|
// 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");
|
URL url = DIYLCStarter.class.getResource("log4j.properties");
|
||||||
Properties properties = new Properties();
|
Properties properties = new Properties();
|
||||||
@@ -131,8 +139,12 @@ public class DIYLCStarter {
|
|||||||
MainFrame mainFrame = new MainFrame();
|
MainFrame mainFrame = new MainFrame();
|
||||||
// mainFrame.setLocationRelativeTo(null);
|
// mainFrame.setLocationRelativeTo(null);
|
||||||
|
|
||||||
|
if (splash == null) {
|
||||||
|
LOG.warn("Splash screen could not be initialized", splashException);
|
||||||
|
} else {
|
||||||
splash.setVisible(false);
|
splash.setVisible(false);
|
||||||
splash.dispose();
|
splash.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
mainFrame.setVisible(true);
|
mainFrame.setVisible(true);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user