1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 package com.drazzib.netpisteur.ui;
28
29 import java.awt.BorderLayout;
30 import java.awt.Font;
31 import java.awt.GridLayout;
32 import java.awt.event.MouseAdapter;
33 import java.awt.event.MouseEvent;
34
35 import javax.swing.ImageIcon;
36 import javax.swing.JButton;
37 import javax.swing.JFrame;
38 import javax.swing.JLabel;
39 import javax.swing.JPanel;
40 import javax.swing.SwingConstants;
41 import javax.swing.WindowConstants;
42
43 import org.apache.commons.logging.Log;
44 import org.apache.commons.logging.LogFactory;
45
46 import com.drazzib.netpisteur.util.Messages;
47 import com.drazzib.netpisteur.util.SwingUtils;
48
49 /**
50 * @author equipe Netpisteur
51 */
52 public class WaitSplashScreen extends JFrame {
53
54 private static Log log = LogFactory.getLog(WaitSplashScreen.class);
55
56 /**
57 *
58 */
59 private static final long serialVersionUID = -2138561695345965745L;
60
61 private JPanel panelAll, panelNorth, panelWest, panelEast, panelSouth,
62 titrePanel, panelCenter, demarragePanel, boutonPanel;
63
64 private JLabel titreLabel, image, contenu;
65
66 private JButton demarrageOkBouton;
67
68
69
70
71 /** Creates new form Config */
72 public WaitSplashScreen() {
73 setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
74 initComponents();
75 }
76
77
78
79
80 /**
81 * Initialisation of the components
82 */
83 private void initComponents() {
84
85 this.panelAll = new JPanel(new BorderLayout());
86 this.panelNorth = new JPanel();
87 this.panelWest = new JPanel();
88 this.panelEast = new JPanel();
89 this.panelSouth = new JPanel();
90 this.panelCenter = new JPanel(new BorderLayout());
91 this.demarragePanel = new JPanel();
92 this.boutonPanel = new JPanel();
93 this.titrePanel = new JPanel();
94 this.titreLabel = new JLabel();
95 this.image = new JLabel();
96 this.contenu = new JLabel();
97 this.demarrageOkBouton = new JButton();
98
99
100 Font titre = new Font("Arial", Font.BOLD, 15);
101
102
103
104 this.titrePanel.setLayout(new GridLayout(1, 2));
105 this.demarragePanel.setLayout(new GridLayout(3, 1));
106 this.boutonPanel.setLayout(new GridLayout(1, 3));
107
108 this.titreLabel.setText(Messages.getString("DemarrageWindow.START"));
109 this.titreLabel.setHorizontalAlignment(SwingConstants.RIGHT);
110 this.titreLabel.setFont(titre);
111 this.image.setIcon(new ImageIcon(getClass().getResource(
112 "/com/drazzib/netpisteur/resources/logo.png")));
113 this.titrePanel.add(this.titreLabel);
114 this.titrePanel.add(this.image);
115
116 this.demarragePanel.add(new JLabel());
117 this.contenu.setText(Messages
118 .getString("DemarrageWindow.CLICK_2_START"));
119 this.contenu.setHorizontalAlignment(SwingConstants.CENTER);
120 this.demarragePanel.add(this.contenu);
121 this.demarragePanel.add(new JLabel());
122
123 this.demarrageOkBouton.setText(Messages
124 .getString("DemarrageWindow.START_BUTTON"));
125
126 this.demarrageOkBouton.addMouseListener(new MouseAdapter() {
127 public void mouseReleased(MouseEvent evt) {
128 demarrageOkBoutonMouseReleased(evt);
129 }
130 });
131 this.boutonPanel.add(new JLabel());
132 this.boutonPanel.add(this.demarrageOkBouton);
133 this.boutonPanel.add(new JLabel());
134
135 this.panelCenter.add(this.titrePanel, BorderLayout.NORTH);
136 this.panelCenter.add(this.demarragePanel, BorderLayout.CENTER);
137 this.panelCenter.add(this.boutonPanel, BorderLayout.SOUTH);
138
139 this.panelAll.add(this.panelNorth, BorderLayout.NORTH);
140 this.panelAll.add(this.panelWest, BorderLayout.WEST);
141 this.panelAll.add(this.panelEast, BorderLayout.EAST);
142 this.panelAll.add(this.panelSouth, BorderLayout.SOUTH);
143 this.panelAll.add(this.panelCenter, BorderLayout.CENTER);
144 getContentPane().add(this.panelAll);
145 this.setLocationRelativeTo(null);
146 pack();
147 }
148
149 /**
150 * Lauching of a mainWindow
151 *
152 * @param evt
153 */
154 void demarrageOkBoutonMouseReleased(MouseEvent evt) {
155
156 MainFrame netpisteurWindow = new MainFrame(false);
157 SwingUtils.maxFrame(netpisteurWindow);
158 netpisteurWindow.setLocationRelativeTo(null);
159 netpisteurWindow.setVisible(true);
160 this.dispose();
161 }
162
163 }
164