X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fgui%2FSplashScreen.java;h=465bc0d3d98947e94d307c1a4e4fabe9a4beefbe;hb=5640ec0623c6d1205e62f9fe15292f32bfdab7d9;hp=a8a849ef249b0cfc409cb5e8f8ade4af035e9175;hpb=04e2d97b71fad3d9d02abbe292ea1fa9ba6d1438;p=jalview.git
diff --git a/src/jalview/gui/SplashScreen.java b/src/jalview/gui/SplashScreen.java
index a8a849e..465bc0d 100755
--- a/src/jalview/gui/SplashScreen.java
+++ b/src/jalview/gui/SplashScreen.java
@@ -36,6 +36,7 @@ import javax.swing.JLabel;
import javax.swing.JLayeredPane;
import javax.swing.JPanel;
import javax.swing.JTextPane;
+import javax.swing.SwingUtilities;
import javax.swing.event.HyperlinkEvent;
import javax.swing.event.HyperlinkListener;
@@ -59,7 +60,8 @@ public class SplashScreen extends JPanel
private JPanel iconimg = new JPanel(new BorderLayout());
- // could change fg, bg, font later to use ChannelProperties
+ // could change fg, bg, font later to use ChannelProperties (these are not
+ // actually being used!)
private static Color bg = Color.WHITE;
private static Color fg = Color.BLACK;
@@ -113,6 +115,10 @@ public class SplashScreen extends JPanel
public SplashScreen(boolean isTransient)
{
this.transientDialog = isTransient;
+ if (this.transientDialog)
+ {
+ Desktop.instance.acquireDialogQueue();
+ }
if (Platform.isJS()) // BH 2019
{
@@ -170,7 +176,7 @@ public class SplashScreen extends JPanel
}
if (mt.isErrorAny())
{
- System.err.println("Error when loading images!");
+ jalview.bin.Console.errPrintln("Error when loading images!");
}
} while (!mt.checkAll());
Desktop.instance.setIconImages(ChannelProperties.getIconList());
@@ -226,7 +232,8 @@ public class SplashScreen extends JPanel
protected boolean refreshText()
{
String newtext = Desktop.instance.getAboutMessage();
- // System.err.println("Text found: \n"+newtext+"\nEnd of newtext.");
+ // jalview.bin.Console.errPrintln("Text found: \n"+newtext+"\nEnd of
+ // newtext.");
if (oldTextLength != newtext.length())
{
iframe.setVisible(false);
@@ -237,8 +244,9 @@ public class SplashScreen extends JPanel
* SwingJS doesn't have HTMLEditorKit, required for a JTextPane
* to display formatted html, so we use a simple alternative
*/
- String text = "
![](\"swingjs/j2s/images/jalview_logo-48.png\"/)
"
- + newtext + "";
+ String text = "
" + newtext
+ + "
";
JLabel ta = new JLabel(text);
ta.setOpaque(true);
ta.setBackground(Color.white);
@@ -264,15 +272,19 @@ public class SplashScreen extends JPanel
splashText.addMouseListener(closer);
splashText.setVisible(true);
- splashText.setSize(new Dimension(750, 375 + logoSize));
+ splashText.setSize(new Dimension(750,
+ 425 + logoSize + (Platform.isJS() ? 40 : 0)));
splashText.setBackground(bg);
splashText.setForeground(fg);
splashText.setFont(font);
add(splashText, BorderLayout.CENTER);
revalidate();
- iframe.setBounds((Desktop.instance.getWidth() - 750) / 2,
- (Desktop.instance.getHeight() - 375) / 2, 750,
- splashText.getHeight() + iconimg.getHeight());
+ int width = Math.max(splashText.getWidth(), iconimg.getWidth());
+ int height = splashText.getHeight() + iconimg.getHeight();
+ iframe.setBounds(
+ Math.max(0, (Desktop.instance.getWidth() - width) / 2),
+ Math.max(0, (Desktop.instance.getHeight() - height) / 2),
+ width, height);
iframe.validate();
iframe.setVisible(true);
return true;
@@ -317,7 +329,6 @@ public class SplashScreen extends JPanel
}
closeSplash();
- Desktop.instance.startDialogQueue();
}
/**
@@ -325,10 +336,26 @@ public class SplashScreen extends JPanel
*/
public void closeSplash()
{
+ if (this.transientDialog)
+ {
+ Desktop.instance.releaseDialogQueue();
+ }
try
{
-
- iframe.setClosed(true);
+ final JInternalFrame frme = iframe;
+ SwingUtilities.invokeLater(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ try
+ {
+ frme.setClosed(true);
+ } catch (Exception ex)
+ {
+ }
+ }
+ });
} catch (Exception ex)
{
}