2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
3 * Copyright (C) 2008 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 extends JPanel implements Runnable
33 boolean visible = true;
35 JInternalFrame iframe;
44 * Creates a new SplashScreen object.
48 Thread t = new Thread(this);
53 * ping the jalview version page then create and display the jalview
54 * splashscreen window.
56 void initSplashScreenWindow()
58 addMouseListener(new MouseAdapter()
60 public void mousePressed(MouseEvent evt)
66 } catch (Exception ex)
74 java.net.URL url = getClass().getResource("/images/logo.gif");
78 image = java.awt.Toolkit.getDefaultToolkit().createImage(url);
80 MediaTracker mt = new MediaTracker(this);
81 mt.addImage(image, 0);
83 Desktop.instance.setIconImage(image);
85 } catch (Exception ex)
89 iframe = new JInternalFrame();
90 iframe.setFrameIcon(null);
91 iframe.setClosable(false);
92 iframe.setContentPane(this);
93 iframe.setLayer(JLayeredPane.PALETTE_LAYER);
95 Desktop.desktop.add(iframe);
97 iframe.setVisible(true);
98 iframe.setBounds((int) ((Desktop.instance.getWidth() - 750) / 2),
99 (int) ((Desktop.instance.getHeight() - 160) / 2), 750, 190);
103 * Create splash screen, display it and clear it off again.
107 initSplashScreenWindow();
108 long startTime = System.currentTimeMillis() / 1000;
115 } catch (Exception ex)
119 if (((System.currentTimeMillis() / 1000) - startTime) > 5)
133 public void closeSplash()
138 iframe.setClosed(true);
139 } catch (Exception ex)
150 public void paintComponent(Graphics g)
152 g.setColor(Color.white);
153 g.fillRect(0, 0, getWidth(), getHeight());
154 g.setColor(Color.black);
155 g.setFont(new Font("Verdana", Font.BOLD, fontSize + 6));
159 g.drawImage(image, 5, yoffset + 12, this);
164 g.drawString("Jalview " + jalview.bin.Cache.getProperty("VERSION"), 50,
167 FontMetrics fm = g.getFontMetrics();
168 int vwidth = fm.stringWidth("Jalview "
169 + jalview.bin.Cache.getProperty("VERSION"));
170 g.setFont(new Font("Verdana", Font.BOLD, fontSize + 2));
171 g.drawString("Last updated: "
172 + jalview.bin.Cache.getDefault("BUILD_DATE", "unknown"),
174 if (jalview.bin.Cache.getDefault("LATEST_VERSION", "Checking").equals(
177 // Displayed when code version and jnlp version do not match
178 g.drawString("...Checking latest version...", 50, y += fontSize + 10);
180 g.setColor(Color.black);
182 else if (!jalview.bin.Cache.getDefault("LATEST_VERSION", "Checking")
183 .equals(jalview.bin.Cache.getProperty("VERSION")))
185 if (jalview.bin.Cache.getProperty("VERSION").toLowerCase().indexOf(
186 "automated build") == -1)
188 // Displayed when code version and jnlp version do not match and code
189 // version is not a development build
190 g.setColor(Color.red);
194 "!! Jalview version "
195 + jalview.bin.Cache.getDefault(
196 "LATEST_VERSION", "..Checking..")
197 + " is available for download from http://www.jalview.org !!",
198 50, y += fontSize + 10);
200 g.setColor(Color.black);
203 g.setFont(new Font("Verdana", Font.BOLD, fontSize));
206 "Authors: Andrew Waterhouse, Jim Procter, Michele Clamp, James Cuff, Steve Searle,",
207 50, y += fontSize + 4);
208 g.drawString("David Martin & Geoff Barton.", 60, y += fontSize + 4);
211 "Development managed by The Barton Group, University of Dundee.",
212 50, y += fontSize + 4);
215 "If you use Jalview, please cite: Clamp, M., Cuff, J., Searle, S. M. and Barton, G. J. (2004),",
216 50, y += fontSize + 4);
219 "\"The Jalview Java Alignment Editor\" Bioinformatics, 2004 20; 426-7.",
220 50, y += fontSize + 4);