2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
3 * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
11 * Jalview is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty
13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 * PURPOSE. See the GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
21 import java.awt.event.*;
31 public class SplashScreen extends JPanel implements Runnable
33 boolean visible = true;
35 JPanel iconimg = new JPanel(new BorderLayout());
37 JTextPane authlist = new JTextPane();
39 JInternalFrame iframe;
48 * Creates a new SplashScreen object.
52 Thread t = new Thread(this);
56 MouseAdapter closer = new MouseAdapter()
58 public void mousePressed(MouseEvent evt)
64 } catch (Exception ex)
71 * ping the jalview version page then create and display the jalview
72 * splashscreen window.
74 void initSplashScreenWindow()
76 addMouseListener(closer);
79 java.net.URL url = getClass().getResource("/images/logo.gif");
83 image = java.awt.Toolkit.getDefaultToolkit().createImage(url);
85 MediaTracker mt = new MediaTracker(this);
86 mt.addImage(image, 0);
88 Desktop.instance.setIconImage(image);
90 } catch (Exception ex)
94 iframe = new JInternalFrame();
95 iframe.setFrameIcon(null);
96 iframe.setClosable(false);
97 this.setLayout(new BorderLayout());
98 iframe.setContentPane(this);
99 iframe.setLayer(JLayeredPane.PALETTE_LAYER);
101 Desktop.desktop.add(iframe);
102 SplashImage splashimg = new SplashImage(image);
103 iconimg.add(splashimg, BorderLayout.CENTER);
104 add(iconimg, BorderLayout.WEST);
105 add(authlist, BorderLayout.CENTER);
106 authlist.setEditable(false);
107 authlist.addMouseListener(closer);
109 iframe.setVisible(true);
110 iframe.setBounds((int) ((Desktop.instance.getWidth() - 750) / 2),
111 (int) ((Desktop.instance.getHeight() - 160) / 2), 750,
112 iframe.getPreferredSize().height);
119 * update text in author text panel reflecting current version information
121 protected boolean refreshText()
123 String newtext = Desktop.instance.getAboutMessage(true).toString();
124 if (oldtext != newtext.hashCode())
126 oldtext = newtext.hashCode();
127 authlist.setContentType("text/html");
128 authlist.setText(newtext);
135 * Create splash screen, display it and clear it off again.
139 initSplashScreenWindow();
141 long startTime = System.currentTimeMillis() / 1000;
148 } catch (Exception ex)
152 if (((System.currentTimeMillis() / 1000) - startTime) > 5)
171 public void closeSplash()
176 iframe.setClosed(true);
177 } catch (Exception ex)
182 public class SplashImage extends JPanel
186 public SplashImage(Image todisplay)
189 setPreferredSize(new Dimension(image.getWidth(this) + 8,
190 image.getHeight(this)));
193 public void paintComponent(Graphics g)
195 g.setColor(Color.white);
196 g.fillRect(0, 0, getWidth(), getHeight());
197 g.setColor(Color.black);
198 g.setFont(new Font("Verdana", Font.BOLD, fontSize + 6));
202 g.drawImage(image, 4, (getHeight() - image.getHeight(this)) / 2,
209 * g.drawString("Jalview " + jalview.bin.Cache.getProperty("VERSION"), 50,
212 * FontMetrics fm = g.getFontMetrics(); int vwidth =
213 * fm.stringWidth("Jalview " + jalview.bin.Cache.getProperty("VERSION"));
214 * g.setFont(new Font("Verdana", Font.BOLD, fontSize + 2)); g.drawString(
215 * "Last updated: " + jalview.bin.Cache.getDefault("BUILD_DATE", "unknown"),
216 * 50 + vwidth + 5, y); if (jalview.bin.Cache.getDefault("LATEST_VERSION",
217 * "Checking").equals( "Checking")) { // Displayed when code version and
218 * jnlp version do not match g.drawString("...Checking latest version...",
219 * 50, y += fontSize + 10); y += 5; g.setColor(Color.black); } else if
220 * (!jalview.bin.Cache.getDefault("LATEST_VERSION", "Checking")
221 * .equals(jalview.bin.Cache.getProperty("VERSION"))) { if
222 * (jalview.bin.Cache.getProperty("VERSION").toLowerCase()
223 * .indexOf("automated build") == -1) { // Displayed when code version and
224 * jnlp version do not match and code // version is not a development build
225 * g.setColor(Color.red); } g.drawString( "!! Jalview version " +
226 * jalview.bin.Cache.getDefault("LATEST_VERSION", "..Checking..") +
227 * " is available for download from "
228 * +jalview.bin.Cache.getDefault("www.jalview.org"
229 * ,"http://www.jalview.org")+" !!", 50, y += fontSize + 10); y += 5;
230 * g.setColor(Color.black); }
232 * g.setFont(new Font("Verdana", Font.BOLD, fontSize)); g.drawString(
233 * "Authors: Jim Procter, Andrew Waterhouse, Michele Clamp, James Cuff, Steve Searle,"
234 * , 50, y += fontSize + 4); g.drawString("David Martin & Geoff Barton.",
235 * 60, y += fontSize + 4); g.drawString(
236 * "Development managed by The Barton Group, University of Dundee.", 50, y
237 * += fontSize + 4); g.drawString("If you use Jalview, please cite: ", 50,
238 * y += fontSize + 4); g.drawString(
239 * "Waterhouse, A.M., Procter, J.B., Martin, D.M.A, Clamp, M. and Barton, G. J. (2009)"
240 * , 50, y += fontSize + 4); g.drawString(
241 * "Jalview Version 2 - a multiple sequence alignment editor and analysis workbench"
242 * , 50, y += fontSize + 4);
243 * g.drawString("Bioinformatics doi: 10.1093/bioinformatics/btp033", 50, y
244 * += fontSize + 4); }