1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package org.devaki.nextobjects.ui.main;
22
23 import java.awt.Color;
24 import java.awt.Cursor;
25 import java.awt.Dimension;
26 import java.awt.Frame;
27 import java.awt.Toolkit;
28 import java.awt.BorderLayout;
29 import java.awt.Window;
30 import javax.swing.BorderFactory;
31 import javax.swing.JLabel;
32 import javax.swing.JPanel;
33 import javax.swing.JProgressBar;
34 import javax.swing.ImageIcon;
35
36 /***
37 * This class shows the splash screen during the program loading
38 */
39 public class SplashScreen extends Window
40 {
41 /***
42 * The main window of the splashscreen
43 */
44 private JPanel jPanelMain= new JPanel(new BorderLayout());
45
46 /***
47 * The splashscreen progressbar
48 */
49 public JProgressBar jProgressBar1= new JProgressBar();
50
51 /***
52 * Create a new 'SplashScreen' object
53 */
54 public SplashScreen()
55 {
56 super(new Frame());
57
58
59 ClassLoader cl= this.getClass().getClassLoader();
60 JLabel jLabelImage= new JLabel(new ImageIcon(cl.getResource("org/devaki/nextobjects/icons/splash.png")));
61
62 this.setCursor(new Cursor(Cursor.WAIT_CURSOR));
63 jProgressBar1.setStringPainted(true);
64 Toolkit tk= this.getToolkit();
65
66
67 this.setSize(new Dimension(550, 355));
68
69 int x= (tk.getScreenSize().width - 550) / 2;
70 int y= (tk.getScreenSize().height - 355) / 2;
71 this.setLocation(x, y);
72
73
74
75 this.jPanelMain.setBorder(BorderFactory.createLineBorder(Color.black));
76
77
78
79 this.jPanelMain.add(jLabelImage, BorderLayout.CENTER);
80 this.jPanelMain.add(jProgressBar1, BorderLayout.SOUTH);
81
82 this.add(jPanelMain);
83 }
84 }