set window to decorated even if error occurs during very early stage
When the window is undecorated and an error occurs very early, e.g. during java version check, the order of the calls in the fail method is significant. super.fail() will call setStatusAsync, which will create the interface using EventQueue.invokeLater, if it does not exist yet. Therefore we must first call super.fail(), and then asynchronously make the window decorated again. Otherwise the window might not be created yet. Closes #57
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
|
||||
package com.threerings.getdown.launcher;
|
||||
|
||||
import java.awt.EventQueue;
|
||||
import java.awt.Color;
|
||||
import java.awt.Container;
|
||||
import java.awt.IllegalComponentStateException;
|
||||
@@ -22,7 +23,6 @@ import java.security.cert.CertificateFactory;
|
||||
import java.security.cert.X509Certificate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
@@ -231,6 +231,10 @@ public class GetdownApp
|
||||
|
||||
@Override
|
||||
protected void fail (String message) {
|
||||
super.fail(message);
|
||||
EventQueue.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// if the frame was set to be undecorated, make window decoration available
|
||||
// to allow the user to close the window
|
||||
if (_frame != null && _frame.isUndecorated()) {
|
||||
@@ -244,7 +248,8 @@ public class GetdownApp
|
||||
_frame.setUndecorated(false);
|
||||
showContainer();
|
||||
}
|
||||
super.fail(message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected JFrame _frame;
|
||||
|
||||
Reference in New Issue
Block a user