41 |
|
*/ |
42 |
|
public static final String DEFAULT_CONFIG_FILE = "./etc/default.conf"; |
43 |
|
|
44 |
+ |
/** |
45 |
+ |
* The time in seconds to display the splash |
46 |
+ |
* screen for |
47 |
+ |
*/ |
48 |
+ |
public static final int DISPLAY_SPLASH_TIME_SECONDS = 3; |
49 |
+ |
|
50 |
|
//---STATIC METHODS--- |
51 |
|
|
52 |
|
/** |
74 |
|
|
75 |
|
// the main frame (passed the two panels) |
76 |
|
Conient client = new Conient(data, control); |
77 |
+ |
conientFrame = (Frame) client; |
78 |
|
Conient.addMessage("Conient {an i-scream Client} © 2001 University of Kent & Project i-scream"); |
79 |
|
|
80 |
|
Conient.addMessage("Conient ready."); |
81 |
+ |
|
82 |
|
} |
75 |
– |
|
83 |
|
|
84 |
+ |
/** |
85 |
+ |
* A static accessor, allowing components of the system |
86 |
+ |
* to get hold of the root frame of the system. |
87 |
+ |
* |
88 |
+ |
* see conientFrame attribute for details. |
89 |
+ |
* |
90 |
+ |
* @return the root Conient frame |
91 |
+ |
*/ |
92 |
+ |
public static Frame getFrame() { |
93 |
+ |
return conientFrame; |
94 |
+ |
} |
95 |
+ |
|
96 |
|
//---CONSTRUCTORS--- |
97 |
|
|
98 |
|
/** |
136 |
|
// add the status panel to the bottom border |
137 |
|
getContentPane().add(bottom, "South"); |
138 |
|
|
139 |
< |
// show the window |
139 |
> |
// a nice icon for the window |
140 |
> |
setIconImage((new ImageIcon("./uk/ac/ukc/iscream/conient/server.gif")).getImage()); |
141 |
> |
|
142 |
> |
// and just because we can, a silly splash screen |
143 |
> |
// of the dudes that did this funky gibble |
144 |
> |
Splash splash = new Splash(); |
145 |
> |
splash.show(); |
146 |
> |
// wait |
147 |
> |
try { |
148 |
> |
Thread.sleep(DISPLAY_SPLASH_TIME_SECONDS * 1000); |
149 |
> |
} catch (InterruptedException e) { |
150 |
> |
// don't do anything, we don't care |
151 |
> |
} |
152 |
> |
//loose the window |
153 |
> |
splash.dispose(); |
154 |
> |
splash = null; |
155 |
> |
// show the main window |
156 |
|
show(); |
157 |
|
} |
158 |
|
|
236 |
|
static JTextArea _messages = new JTextArea(); |
237 |
|
{ |
238 |
|
_messages.setLineWrap(true); |
239 |
+ |
} |
240 |
+ |
|
241 |
+ |
/** |
242 |
+ |
* Holds a reference to the root frame for Conient |
243 |
+ |
* This is only used by dialogs (specifically the configurationn |
244 |
+ |
* dialog) so that it can be modal, please use the accessor. |
245 |
+ |
*/ |
246 |
+ |
private static Frame conientFrame; |
247 |
+ |
|
248 |
+ |
//---INNER CLASSES---- |
249 |
+ |
|
250 |
+ |
/** |
251 |
+ |
* An inner class to display a splash screen |
252 |
+ |
*/ |
253 |
+ |
private class Splash extends JWindow { |
254 |
+ |
|
255 |
+ |
/** |
256 |
+ |
* Constructs a new splash screen |
257 |
+ |
*/ |
258 |
+ |
public Splash() { |
259 |
+ |
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); |
260 |
+ |
JPanel splash = new JPanel(); |
261 |
+ |
splash.setBackground(Color.black); |
262 |
+ |
JLabel image = new JLabel((new ImageIcon("./uk/ac/ukc/iscream/conient/i-scream-splash.gif"))); |
263 |
+ |
splash.add(image); |
264 |
+ |
setContentPane(splash); |
265 |
+ |
Dimension screen = getToolkit().getScreenSize(); |
266 |
+ |
pack(); |
267 |
+ |
setLocation((screen.width - getSize().width) / 2, |
268 |
+ |
(screen.height - getSize().height) / 2); |
269 |
+ |
|
270 |
+ |
|
271 |
+ |
} |
272 |
|
} |
273 |
|
} |