Formatting changes
[jalview.git] / src / jalview / gui / SplashScreen.java
1 /*\r
2  * Jalview - A Sequence Alignment Editor and Viewer\r
3  * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
4  *\r
5  * This program is free software; you can redistribute it and/or\r
6  * modify it under the terms of the GNU General Public License\r
7  * as published by the Free Software Foundation; either version 2\r
8  * of the License, or (at your option) any later version.\r
9  *\r
10  * This program is distributed in the hope that it will be useful,\r
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
13  * GNU General Public License for more details.\r
14  *\r
15  * You should have received a copy of the GNU General Public License\r
16  * along with this program; if not, write to the Free Software\r
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
18  */\r
19 package jalview.gui;\r
20 \r
21 import java.awt.*;\r
22 import java.awt.event.*;\r
23 \r
24 import javax.swing.*;\r
25 \r
26 \r
27 /**\r
28  * DOCUMENT ME!\r
29  *\r
30  * @author $author$\r
31  * @version $Revision$\r
32  */\r
33 public class SplashScreen extends JPanel implements Runnable\r
34 {\r
35     boolean visible = true;\r
36     JInternalFrame iframe;\r
37     Image image;\r
38     int fontSize = 11;\r
39     int yoffset = 30;\r
40 \r
41     /**\r
42      * Creates a new SplashScreen object.\r
43      *\r
44      * @param iframe DOCUMENT ME!\r
45      * @param i DOCUMENT ME!\r
46      */\r
47     public SplashScreen(JInternalFrame iframe, Image i)\r
48     {\r
49         this.iframe = iframe;\r
50         image = i;\r
51 \r
52         Thread t = new Thread(this);\r
53         t.start();\r
54         addMouseListener(new MouseAdapter()\r
55             {\r
56                 public void mousePressed(MouseEvent evt)\r
57                 {\r
58                     try\r
59                     {\r
60                         closeSplash();\r
61                     }\r
62                     catch (Exception ex)\r
63                     {\r
64                     }\r
65                 }\r
66             });\r
67     }\r
68 \r
69     /**\r
70      * DOCUMENT ME!\r
71      */\r
72     public void run()\r
73     {\r
74         long startTime = System.currentTimeMillis() / 1000;\r
75 \r
76         while (visible)\r
77         {\r
78             if (((System.currentTimeMillis() / 1000) - startTime) > 5)\r
79             {\r
80                 visible = false;\r
81             }\r
82 \r
83             try\r
84             {\r
85                 Thread.sleep(1000);\r
86             }\r
87             catch (Exception ex)\r
88             {\r
89             }\r
90         }\r
91 \r
92         closeSplash();\r
93     }\r
94 \r
95     /**\r
96      * DOCUMENT ME!\r
97      */\r
98     public void closeSplash()\r
99     {\r
100         try\r
101         {\r
102             iframe.setClosed(true);\r
103         }\r
104         catch (Exception ex)\r
105         {\r
106         }\r
107     }\r
108 \r
109     /**\r
110      * DOCUMENT ME!\r
111      *\r
112      * @param g DOCUMENT ME!\r
113      */\r
114     public void paintComponent(Graphics g)\r
115     {\r
116         g.setColor(Color.white);\r
117         g.fillRect(0, 0, getWidth(), getHeight());\r
118         g.setColor(Color.black);\r
119         g.setFont(new Font("Verdana", Font.BOLD, fontSize + 6));\r
120 \r
121         if (image != null)\r
122         {\r
123             g.drawImage(image, 5, yoffset + 12, this);\r
124         }\r
125 \r
126         g.drawString("JalView 2005 ", 50, yoffset);\r
127         g.setFont(new Font("Verdana", Font.BOLD, fontSize + 2));\r
128         g.drawString("Version " + jalview.bin.Cache.VERSION +\r
129             "; Last updated: " + jalview.bin.Cache.BUILD_DATE, 180, yoffset);\r
130         g.setFont(new Font("Verdana", Font.BOLD, fontSize));\r
131         g.drawString("Authors: Michele Clamp, James Cuff, Steve Searle, Andrew Waterhouse, Jim Procter & Geoff Barton.",\r
132             50, yoffset + 20);\r
133         g.drawString("Current development managed by Andrew Waterhouse; Barton Group, University of Dundee.",\r
134             50, yoffset + 24 + fontSize);\r
135         g.drawString("If  you use JalView, please cite: Clamp, M., Cuff, J., Searle, S. M. and Barton, G. J. (2004),",\r
136             50, yoffset + 28 + (fontSize * 2));\r
137         g.drawString("\"The Jalview Java Alignment Editor\" Bioinformatics,  2004 12;426-7.",\r
138             50, yoffset + 32 + (fontSize * 3));\r
139     }\r
140 }\r