Splash NullPointer fixed

git-svn-id: svn://svn.jdownloader.org/jdownloader/trunk@6188 ebf7c1c2-ba36-0410-9fe8-c592906822b4
This commit is contained in:
jiaz 2009-06-13 16:22:08 +00:00
parent 64523cc6a3
commit ae5a39af8b
2 changed files with 21 additions and 3 deletions

View File

@ -307,6 +307,18 @@ public class Main {
}
}.waitForEDT();
} else {
new GuiRunnable<Object>() {
// @Override
public Object runSave() {
try {
SPLASH = new SplashScreen();
} catch (Exception e) {
JDLogger.exception(e);
}
return null;
}
}.waitForEDT();
}
}
@ -416,7 +428,6 @@ public class Main {
}
private static void increaseSplashStatus() {
if (SPLASH == null) return;
SPLASH.setNextImage();
}
@ -484,14 +495,14 @@ public class Main {
public void run() {
JDUtilities.getController().addControlListener(new ControlListener() {
public void controlEvent(ControlEvent event) {
if (event.getID() == ControlEvent.CONTROL_INIT_COMPLETE && event.getSource() instanceof Main) {
if (event.getID() == ControlEvent.CONTROL_INIT_COMPLETE && event.getSource() instanceof Main) {
JDUtilities.getController().removeControlListener(this);
stop = true;
}
}
});
int i = 10;
while (!stop) {
SPLASH.setProgress(i % 100, 100, JDLocale.L("gui.splash.progress.updateplugins", "Update Plugins"));
try {

View File

@ -71,11 +71,16 @@ public class SplashScreen implements ActionListener {
private int imageCounter = 1;
private JProgressBar progress;
private boolean unused = false;
public void setNextImage() {
imageCounter++;
}
public SplashScreen() {
unused = true;
}
public SplashScreen(Image image) throws IOException, AWTException {
// final URL url =
@ -185,11 +190,13 @@ public class SplashScreen implements ActionListener {
}
public void finish() {
if (unused) return;
timer.stop();
window.dispose();
}
public void setProgress(final int i, final int j, final String l) {
if (unused) return;
new GuiRunnable<Object>() {
@Override