2 * Jalview - A Sequence Alignment Editor and Viewer
3 * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22 import java.awt.event.*;
31 public class SplashScreen
32 extends JPanel implements Runnable
34 boolean visible = true;
35 JInternalFrame iframe;
41 * Creates a new SplashScreen object.
45 Thread t = new Thread(this);
49 * ping the jalview version page then create and display the jalview splashscreen window.
51 void initSplashScreenWindow() {
52 addMouseListener(new MouseAdapter()
54 public void mousePressed(MouseEvent evt)
69 java.net.URL url = getClass().getResource("/images/logo.gif");
73 image = java.awt.Toolkit.getDefaultToolkit().createImage(url);
75 MediaTracker mt = new MediaTracker(this);
76 mt.addImage(image, 0);
78 Desktop.instance.setIconImage(image);
86 iframe = new JInternalFrame();
87 iframe.setFrameIcon(null);
88 iframe.setClosable(false);
89 iframe.setContentPane(this);
90 iframe.setLayer(JLayeredPane.PALETTE_LAYER);
92 Desktop.desktop.add(iframe);
94 iframe.setVisible(true);
95 iframe.setBounds( (int) ( (Desktop.instance.getWidth() - 750) / 2),
96 (int) ( (Desktop.instance.getHeight() - 160) / 2),
101 * Create splash screen, display it and clear it off again.
105 initSplashScreenWindow();
106 long startTime = System.currentTimeMillis() / 1000;
118 if ( ( (System.currentTimeMillis() / 1000) - startTime) > 5)
132 public void closeSplash()
137 iframe.setClosed(true);
146 * @param g DOCUMENT ME!
148 public void paintComponent(Graphics g)
150 g.setColor(Color.white);
151 g.fillRect(0, 0, getWidth(), getHeight());
152 g.setColor(Color.black);
153 g.setFont(new Font("Verdana", Font.BOLD, fontSize + 6));
157 g.drawImage(image, 5, yoffset + 12, this);
162 g.drawString("Jalview " + jalview.bin.Cache.getProperty("VERSION"), 50, y);
164 FontMetrics fm = g.getFontMetrics();
165 int vwidth = fm.stringWidth("Jalview " +
166 jalview.bin.Cache.getProperty("VERSION"));
167 g.setFont(new Font("Verdana", Font.BOLD, fontSize + 2));
168 g.drawString("Last updated: " +
169 jalview.bin.Cache.getDefault("BUILD_DATE", "unknown"),
172 if (jalview.bin.Cache.getDefault("LATEST_VERSION",
173 "Checking").equals("Checking"))
175 // Displayed when code version and jnlp version do not match
176 g.drawString("...Checking latest version...",
177 50, y += fontSize + 10);
179 g.setColor(Color.black);
181 else if (!jalview.bin.Cache.getDefault("LATEST_VERSION", "Checking").equals(
182 jalview.bin.Cache.getProperty("VERSION")))
184 // Displayed when code version and jnlp version do not match
185 g.setColor(Color.red);
186 g.drawString("!! Jalview version " +
187 jalview.bin.Cache.getDefault("LATEST_VERSION",
190 " is available for download from http://www.jalview.org !!",
191 50, y += fontSize + 10);
193 g.setColor(Color.black);
196 g.setFont(new Font("Verdana", Font.BOLD, fontSize));
197 g.drawString("Authors: Michele Clamp, James Cuff, Steve Searle, Andrew Waterhouse, Jim Procter & Geoff Barton.",
198 50, y += fontSize + 4);
199 g.drawString("Current development managed by Andrew Waterhouse; Barton Group, University of Dundee.",
200 50, y += fontSize + 4);
201 g.drawString("If you use JalView, please cite: Clamp, M., Cuff, J., Searle, S. M. and Barton, G. J. (2004),",
202 50, y += fontSize + 4);
204 "\"The Jalview Java Alignment Editor\" Bioinformatics, 2004 20; 426-7.",
205 50, y += fontSize + 4);