View Javadoc

1   /*
2    * This file is part of NetPisteur.
3    * 
4    * Copyright 2001-2002 : Olivier CORNEC, David BOUANCHEAU, Loic LOPEZ,
5    *                       Gaetan BOUDARD, Mael LE LANNOU, Julien ROBINEAU
6    * 
7    * Copyright 2002-2003 : Olivier BRIENS, Simon DEZE, Florence FRIGOULT,
8    *                       Olivier JOURNEAULT, Francois MARTINIER, Damien RAUDE-MORVAN
9    * 
10   * Copyright 2004-2007 : Damien RAUDE-MORVAN
11   * 
12   * NetPisteur is free software; you can redistribute it and/or modify
13   * it under the terms of the GNU General Public License as published by
14   * the Free Software Foundation; either version 2 of the License, or
15   * (at your option) any later version.
16   *
17   * NetPisteur is distributed in the hope that it will be useful,
18   * but WITHOUT ANY WARRANTY; without even the implied warranty of
19   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20   * GNU General Public License for more details.
21   *
22   * You should have received a copy of the GNU General Public License
23   * along with NetPisteur; if not, write to the Free Software
24   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
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  	// constructor
70  
71  	/** Creates new form Config */
72  	public WaitSplashScreen() {
73  		setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
74  		initComponents();
75  	}
76  
77  	// //////////////////////////////
78  	// operations
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  		// Cration de la police des titres
100 		Font titre = new Font("Arial", Font.BOLD, 15); //$NON-NLS-1$
101 
102 		// Mot de passe
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")); //$NON-NLS-1$
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"))); //$NON-NLS-1$
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")); //$NON-NLS-1$
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")); //$NON-NLS-1$
125 		// demarrageOkBouton.setName("demarrage");
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 	} // initComponents()
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 	} // demarrageOkBoutonMouseReleased()
162 
163 } // class DemarrageWindow
164