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.event.ActionEvent;
32  import java.awt.event.ActionListener;
33  
34  import javax.swing.JButton;
35  import javax.swing.JDialog;
36  import javax.swing.JEditorPane;
37  import javax.swing.JFrame;
38  import javax.swing.JLabel;
39  import javax.swing.JPanel;
40  import javax.swing.SwingConstants;
41  
42  import com.drazzib.netpisteur.util.Messages;
43  
44  /**
45   * Represents the frame that appear when the menu "A Propos..." is clicked
46   * 
47   * @author NetPisteur Team
48   */
49  public class AboutDialog extends JDialog {
50  
51  	/**
52  	 * 
53  	 */
54  	private static final long serialVersionUID = -3272854216720298622L;
55  
56  	// attributes
57  	private JEditorPane pane;
58  
59  	private JLabel label3, label2;
60  
61  	private JPanel panel;
62  
63  	private JButton okButton;
64  
65  	private StringBuffer help;
66  
67  	// Constructor
68  
69  	/**
70  	 * Create a dialog that give informations on the project
71  	 * 
72  	 * @param parent :
73  	 *            owner frame
74  	 * @param modal :
75  	 *            for a modal or non-modal dialog
76  	 */
77  	public AboutDialog(JFrame parent, boolean modal) {
78  
79  		super(parent, modal);
80  
81  		// RAZ par DrazziB (25/11/2002)
82  		// ---- Equipe + Taille ----
83  		getContentPane().setLayout(new BorderLayout());
84  		addNotify();
85  		setSize(480, 320);
86  		setTitle(Messages.getString("AboutDialog.NETPISTEUR")); //$NON-NLS-1$
87  		setResizable(false);
88  
89  		this.label2 = new JLabel(Messages.getString("AboutDialog.NETPISTEUR")); //$NON-NLS-1$
90  		this.label2.setHorizontalAlignment(SwingConstants.CENTER);
91  		this.label2.setFont(new Font("Dialog", 0, 24)); //$NON-NLS-1$
92  		getContentPane().add(this.label2, BorderLayout.NORTH);
93  
94  		this.panel = new JPanel();
95  		BorderLayout gd = new BorderLayout();
96  		this.panel.setLayout(gd);
97  		this.pane = new JEditorPane();
98  		this.pane.setEditable(false);
99  		this.pane.setContentType("text/html"); //$NON-NLS-1$
100 		this.help = new StringBuffer();
101 
102 		this.help.append("<html><body>"); //$NON-NLS-1$
103 		this.help.append(Messages.getString("AboutDialog.ABOUT_1")); //$NON-NLS-1$
104 		this.help
105 				.append("Damien RAUDE-MORVAN, Simon DEZE, Florence FRIGOULT, "); //$NON-NLS-1$
106 		this.help
107 				.append("Olivier BRIENS, Francois MARTINIER &amp; Olivier JOURNEAULT"); //$NON-NLS-1$
108 		this.help.append(Messages.getString("AboutDialog.ABOUT_2")); //$NON-NLS-1$
109 		this.help.append("Olivier CORNEC, David BOUANCHAU, Loc LOPEZ, "); //$NON-NLS-1$
110 		this.help
111 				.append("Gatan BOUDARD, Mael LE LANNOU &amp; Julien ROBINEAU"); //$NON-NLS-1$
112 		this.help.append(Messages.getString("AboutDialog.ABOUT_3")); //$NON-NLS-1$
113 		this.help.append(Messages.getString("AboutDialog.ABOUT_4")); //$NON-NLS-1$
114 		this.help.append(Messages.getString("AboutDialog.ABOUT_5")); //$NON-NLS-1$
115 		this.help.append(Messages.getString("AboutDialog.ABOUT_6")); //$NON-NLS-1$
116 		this.help.append("</body></html>"); //$NON-NLS-1$
117 
118 		this.pane.setText(this.help.toString());
119 		this.panel.add(this.pane);
120 		this.okButton = new JButton(Messages.getString("AboutDialog.OK")); //$NON-NLS-1$
121 		this.panel.add(this.okButton, BorderLayout.SOUTH);
122 		getContentPane().add(this.panel, BorderLayout.CENTER);
123 
124 		this.label3 = new JLabel(Messages.getString("AboutDialog.ABOUT7")); //$NON-NLS-1$
125 		this.label3.setFont(new Font("Dialog", 0, 10)); //$NON-NLS-1$
126 		getContentPane().add(this.label3, BorderLayout.SOUTH);
127 
128 		this.okButton.addActionListener(new ActionListener() {
129 			public void actionPerformed(ActionEvent event) {
130 				dispose();
131 			}
132 		});
133 
134 	} // AboutDialog()
135 
136 } // class AboutDialog
137