01: package vicazh.hyperpool;
02:
03: import java.awt.*;
04: import javax.swing.*;
05:
06: /**
07: * The splash manager
08: *
09: * @author Victor Zhigunov
10: * @version 0.4.0
11: */
12: public class ISplash {
13:
14: private Window window;
15:
16: /**
17: * @param window
18: * splash window
19: */
20: public ISplash(Window window) {
21: this .window = window;
22: new Thread() {
23: public void run() {
24: synchronized (ISplash.this ) {
25: Rectangle r = ISplash.this .window
26: .getGraphicsConfiguration().getBounds();
27: ISplash.this .window
28: .setLocation(
29: r.x
30: + r.width
31: / 2
32: - ISplash.this .window
33: .getSize().width
34: / 2, r.y
35: + r.height
36: / 2
37: - ISplash.this .window
38: .getSize().height
39: / 2);
40: SwingUtilities.invokeLater(new Runnable() {
41: public void run() {
42: ISplash.this .window.setVisible(true);
43: }
44: });
45: try {
46: Thread.sleep(5000);
47: } catch (InterruptedException e) {
48: }
49: }
50: }
51:
52: }.start();
53: }
54:
55: public void hide() {
56: new Thread() {
57: public void run() {
58: synchronized (ISplash.this ) {
59: SwingUtilities.invokeLater(new Runnable() {
60: public void run() {
61: ISplash.this.window.dispose();
62: }
63: });
64: }
65: }
66:
67: }.start();
68: }
69:
70: }
|