mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
Updated splash frame close functionality to also cancel preloading and gui creation process if user has closed splash frame.
This commit is contained in:
@@ -117,27 +117,35 @@ public class ApplicationView implements FView {
|
||||
}
|
||||
});
|
||||
|
||||
AllZone.getCardFactory(); // forces preloading of all cards
|
||||
try {
|
||||
Constant.Runtime.GameType[0] = Constant.GameType.Constructed;
|
||||
SwingUtilities.invokeLater(new Runnable() { // NOPMD by Braids on 8/7/11 1:07 PM: this isn't a web app
|
||||
public void run() {
|
||||
AllZone.setComputer(new ComputerAI_Input(new ComputerAI_General()));
|
||||
|
||||
// Enable only one of the following two lines. The second
|
||||
// is useful for debugging.
|
||||
|
||||
splashFrame.dispose();
|
||||
//splashFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
||||
|
||||
|
||||
splashFrame = null;
|
||||
new OldGuiNewGame();
|
||||
}
|
||||
});
|
||||
} catch (Exception ex) {
|
||||
ErrorViewer.showError(ex);
|
||||
// For the following two blocks, check if user has cancelled SplashFrame.
|
||||
// Note: Error thrown sometimes because log file cannot be accessed
|
||||
if(!splashFrame.getSplashHasBeenClosed()) {
|
||||
AllZone.getCardFactory(); // forces preloading of all cards
|
||||
}
|
||||
|
||||
if(!splashFrame.getSplashHasBeenClosed()) {
|
||||
System.out.println("splashFrame still running");
|
||||
try {
|
||||
Constant.Runtime.GameType[0] = Constant.GameType.Constructed;
|
||||
SwingUtilities.invokeLater(new Runnable() { // NOPMD by Braids on 8/7/11 1:07 PM: this isn't a web app
|
||||
public void run() {
|
||||
AllZone.setComputer(new ComputerAI_Input(new ComputerAI_General()));
|
||||
|
||||
// Enable only one of the following two lines. The second
|
||||
// is useful for debugging.
|
||||
|
||||
splashFrame.dispose();
|
||||
//splashFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
||||
|
||||
|
||||
splashFrame = null;
|
||||
new OldGuiNewGame();
|
||||
}
|
||||
});
|
||||
} catch (Exception ex) {
|
||||
ErrorViewer.showError(ex);
|
||||
}
|
||||
} // End if(splashHasBeenClosed)
|
||||
|
||||
}
|
||||
} // End ApplicationView()
|
||||
}
|
||||
|
||||
@@ -42,6 +42,8 @@ public class SplashFrame extends JFrame {
|
||||
|
||||
private SplashProgressModel monitorModel = null;
|
||||
private SplashProgressComponent monitorView = null;
|
||||
|
||||
private boolean SplashHasBeenClosed = false;
|
||||
|
||||
/**
|
||||
* <p>Create the frame; this <strong>must</strong> be called from an event
|
||||
@@ -102,6 +104,7 @@ public class SplashFrame extends JFrame {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent ae)
|
||||
{
|
||||
setSplashHasBeenClosed(true);
|
||||
dispose();
|
||||
}
|
||||
});
|
||||
@@ -155,10 +158,26 @@ public class SplashFrame extends JFrame {
|
||||
|
||||
/**
|
||||
* Getter for progress monitor model.
|
||||
* @return the BaseProgressMonitor model used in the splash frame.
|
||||
* @return the BraidsProgressMonitor model used in the splash frame.
|
||||
*/
|
||||
public final BraidsProgressMonitor getMonitorModel() {
|
||||
return monitorModel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns state of splash frame, to determine if GUI should continue loading.
|
||||
* @return SplashHasBeenClosed boolean.
|
||||
*/
|
||||
public final boolean getSplashHasBeenClosed() {
|
||||
return SplashHasBeenClosed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets state of splash frame, to determine if GUI should continue loading.
|
||||
* @param SplashHasBeenClosed boolean.
|
||||
*/
|
||||
public final void setSplashHasBeenClosed(boolean neoState) {
|
||||
SplashHasBeenClosed = neoState;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user