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() {
54 java.net.URL url = getClass().getResource("/images/logo.gif");
58 image = java.awt.Toolkit.getDefaultToolkit().createImage(url);
60 MediaTracker mt = new MediaTracker(this);
61 mt.addImage(image, 0);
63 Desktop.instance.setIconImage(image);
70 addMouseListener(new MouseAdapter()
72 public void mousePressed(MouseEvent evt)
84 iframe = new JInternalFrame();
85 iframe.setFrameIcon(null);
86 iframe.setClosable(false);
87 iframe.setContentPane(this);
88 iframe.setLayer(JLayeredPane.PALETTE_LAYER);
90 Desktop.desktop.add(iframe);
92 iframe.setVisible(true);
93 iframe.setBounds( (int) ( (Desktop.instance.getWidth() - 750) / 2),
94 (int) ( (Desktop.instance.getHeight() - 160) / 2),
99 * Create splash screen, display it and clear it off again.
103 initSplashScreenWindow();
104 long startTime = System.currentTimeMillis() / 1000;
116 if ( ( (System.currentTimeMillis() / 1000) - startTime) > 5)
130 public void closeSplash()
135 iframe.setClosed(true);
144 * @param g DOCUMENT ME!
146 public void paintComponent(Graphics g)
148 g.setColor(Color.white);
149 g.fillRect(0, 0, getWidth(), getHeight());
150 g.setColor(Color.black);
151 g.setFont(new Font("Verdana", Font.BOLD, fontSize + 6));
155 g.drawImage(image, 5, yoffset + 12, this);
160 g.drawString("Jalview " + jalview.bin.Cache.getProperty("VERSION"), 50, y);
162 FontMetrics fm = g.getFontMetrics();
163 int vwidth = fm.stringWidth("Jalview " +
164 jalview.bin.Cache.getProperty("VERSION"));
165 g.setFont(new Font("Verdana", Font.BOLD, fontSize + 2));
166 g.drawString("Last updated: " +
167 jalview.bin.Cache.getDefault("BUILD_DATE", "unknown"),
170 if (jalview.bin.Cache.getDefault("LATEST_VERSION",
171 "Checking").equals("Checking"))
173 // Displayed when code version and jnlp version do not match
174 g.drawString("...Checking latest version...",
175 50, y += fontSize + 10);
177 g.setColor(Color.black);
179 else if (!jalview.bin.Cache.getDefault("LATEST_VERSION", "Checking").equals(
180 jalview.bin.Cache.getProperty("VERSION")))
182 // Displayed when code version and jnlp version do not match
183 g.setColor(Color.red);
184 g.drawString("!! Jalview version " +
185 jalview.bin.Cache.getDefault("LATEST_VERSION",
188 " is available for download from http://www.jalview.org !!",
189 50, y += fontSize + 10);
191 g.setColor(Color.black);
194 g.setFont(new Font("Verdana", Font.BOLD, fontSize));
195 g.drawString("Authors: Michele Clamp, James Cuff, Steve Searle, Andrew Waterhouse, Jim Procter & Geoff Barton.",
196 50, y += fontSize + 4);
197 g.drawString("Current development managed by Andrew Waterhouse; Barton Group, University of Dundee.",
198 50, y += fontSize + 4);
199 g.drawString("If you use JalView, please cite: Clamp, M., Cuff, J., Searle, S. M. and Barton, G. J. (2004),",
200 50, y += fontSize + 4);
202 "\"The Jalview Java Alignment Editor\" Bioinformatics, 2004 20; 426-7.",
203 50, y += fontSize + 4);