1 /*
2 * Fsgrep is a simple Java application which allows a user to
3 * search all files in a directory structure for lines matching
4 * a given pattern. Its functionality is a combination of the
5 * Unix 'find' and 'grep' utilities.
6 * Visit [http://fsgrep.sourceforge.net/] for more information.
7 *
8 * Copyright (C) 2003-2006 Murali Krishnan [murali_ca_us@users.sourceforge.net]
9 *
10 * Fsgrep is free software; you can redistribute it and/or modify
11 * it under the terms of version 2 of the GNU General Public
12 * License as published by the Free Software Foundation.
13 *
14 * Fsgrep is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with Fsgrep (see the file named LICENSE.txt); if not, write
21 * to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
22 * Boston, MA 02111-1307 USA
23 */
24
25 package mk.fsgrep.gui;
26
27
28 import java.awt.*;
29
30 import javax.swing.*;
31
32 import mk.fsgrep.Fsgrep;
33
34
35
36 /***
37 * The splash screen that is initially displayed when the GUI is launched.
38 *
39 * @author Murali Krishnan
40 *
41 */
42 public class Splash extends JWindow {
43
44 //------------------------------------------------------------
45 //- Class Variables
46
47
48
49 //------------------------------------------------------------
50 //- Class Functions
51
52
53
54 //------------------------------------------------------------
55 //- Instance Variables
56
57
58
59 //------------------------------------------------------------
60 //- Constructors
61
62 Splash() {
63 super();
64
65 getContentPane().add(makeContents());
66
67 pack();
68 centerInScreen();
69 setVisible(true);
70 }
71
72
73 //------------------------------------------------------------
74 //- Accessors
75
76
77
78 //------------------------------------------------------------
79 //- Settors
80
81
82
83 //------------------------------------------------------------
84 //- Private/Protected Utility Functions
85
86 protected JPanel makeContents() {
87 JPanel result = new JPanel();
88
89 result.setLayout(new BorderLayout());
90 int inset = 5;
91 result.setBorder(BorderFactory.createEmptyBorder(inset, inset, inset, inset));
92 String version = "fsgrep " + Fsgrep.VERSION;
93 result.add(new JLabel(version), BorderLayout.NORTH);
94 result.add(new JLabel("Building the user interface ..."), BorderLayout.SOUTH);
95
96 return result;
97 }
98
99 protected void centerInScreen () {
100 Dimension screenSize = getToolkit().getScreenSize();
101 Dimension windowSize = getPreferredSize();
102
103 int x = (int)(screenSize.getWidth()/2 - windowSize.getWidth()/2);
104 int y = (int)(screenSize.getHeight()/2 - windowSize.getHeight()/2);
105 setLocation(x, y);
106 }
107
108
109
110 //------------------------------------------------------------
111 //- Public Interface Functions
112
113
114
115 //------------------------------------------------------------
116 //- Class Interface Functions
117
118
119
120 //------------------------------------------------------------
121 //- Inner Classes
122
123
124
125 //------------------------------------------------------------
126 //- Main
127
128
129
130 }