JAL-3594 Adjustments to allow JalviewJS to use ChannelProperties, and new utils/chann...
[jalview.git] / src / jalview / gui / SplashScreen.java
index a8a849e..2d5e63b 100755 (executable)
@@ -59,7 +59,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;
@@ -237,8 +238,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 = "<html><br><br><img src=\"swingjs/j2s/images/jalview_logo-48.png\"/><br>"
-                + newtext + "</html>";
+        String text = "<html><br><img src=\""
+                + ChannelProperties.getImageURL("banner") + "\"/>" + newtext
+                + "<br></html>";
         JLabel ta = new JLabel(text);
         ta.setOpaque(true);
         ta.setBackground(Color.white);
@@ -264,15 +266,17 @@ public class SplashScreen extends JPanel
       splashText.addMouseListener(closer);
 
       splashText.setVisible(true);
-      splashText.setSize(new Dimension(750, 375 + logoSize));
+      splashText.setSize(new Dimension(750,
+              375 + 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((Desktop.instance.getWidth() - width) / 2,
+              (Desktop.instance.getHeight() - height) / 2, width, height);
       iframe.validate();
       iframe.setVisible(true);
       return true;