]> git.somenet.org - irc/pjirc-ng.git/blob - src/main/java/irc/AboutDialog.java
Pjirc 2.2.1 as available on the net, reformatted and made it compile.
[irc/pjirc-ng.git] / src / main / java / irc / AboutDialog.java
1 /*****************************************************/
2 /*          This java file is a part of the          */
3 /*                                                   */
4 /*           -  Plouf's Java IRC Client  -           */
5 /*                                                   */
6 /*   Copyright (C)  2002 - 2004 Philippe Detournay   */
7 /*                                                   */
8 /*         All contacts : theplouf@yahoo.com         */
9 /*                                                   */
10 /*  PJIRC is free software; you can redistribute     */
11 /*  it and/or modify it under the terms of the GNU   */
12 /*  General Public License as published by the       */
13 /*  Free Software Foundation; version 2 or later of  */
14 /*  the License.                                     */
15 /*                                                   */
16 /*  PJIRC is distributed in the hope that it will    */
17 /*  be useful, but WITHOUT ANY WARRANTY; without     */
18 /*  even the implied warranty of MERCHANTABILITY or  */
19 /*  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU   */
20 /*  General Public License for more details.         */
21 /*                                                   */
22 /*  You should have received a copy of the GNU       */
23 /*  General Public License along with PJIRC; if      */
24 /*  not, write to the Free Software Foundation,      */
25 /*  Inc., 59 Temple Place, Suite 330, Boston,        */
26 /*  MA  02111-1307  USA                              */
27 /*                                                   */
28 /*****************************************************/
29
30 package irc;
31
32 import java.awt.BorderLayout;
33 import java.awt.Font;
34 import java.awt.Frame;
35 import java.awt.GridLayout;
36 import java.awt.Label;
37 import java.awt.Panel;
38 import java.awt.event.WindowAdapter;
39 import java.awt.event.WindowEvent;
40
41 /**
42  * The about dialog.
43  */
44 public class AboutDialog extends WindowAdapter {
45         private Frame _aboutFrame;
46
47         /**
48          * Open and display the about dialog, using the given IRCConfiguration.
49          * 
50          * @param config
51          *          the IRCConfiguration.
52          */
53         public AboutDialog(IRCConfiguration config) {
54                 displayAboutPage(config);
55         }
56
57         private Label createLabel(String text) {
58                 Label b = new Label(text, Label.CENTER);
59                 b.setFont(new Font("", Font.PLAIN, 12));
60                 return b;
61         }
62
63         private void displayAboutPage(IRCConfiguration config) {
64                 if (_aboutFrame != null)
65                         return;
66                 _aboutFrame = new Frame();
67                 _aboutFrame.setTitle(config.getText(IRCTextProvider.ABOUT_ABOUT));
68                 _aboutFrame.setLayout(new BorderLayout());
69                 _aboutFrame.setFont(new Font("", Font.PLAIN, 12));
70
71                 Panel text = new Panel();
72
73                 text.setLayout(new GridLayout(20, 1));
74                 text.add(createLabel("PJIRC v" + config.getVersion()));
75                 text.add(new Panel());
76                 text.add(createLabel(config.getText(IRCTextProvider.ABOUT_GPL)));
77                 text.add(new Panel());
78                 text.add(createLabel(config.getText(IRCTextProvider.ABOUT_PROGRAMMING)
79                                 + " : Philippe Detournay alias Plouf (theplouf@yahoo.com)"));
80                 text.add(createLabel(config.getText(IRCTextProvider.ABOUT_DESIGN)
81                                 + " : Raphael Seegmuller chez pixxservices.com (pixxservices@pixxservices.com)"));
82                 text.add(new Panel());
83                 text.add(createLabel(config.getText(IRCTextProvider.ABOUT_THANKS)));
84                 text.add(new Panel());
85                 text.add(createLabel("Mandragor : www.mandragor.org"));
86                 text.add(createLabel("Diboo : www.diboo.net"));
87                 text.add(createLabel("Kombat Falcon.be Jerarckill Red Spider"));
88                 text.add(createLabel("Ezequiel Jiquera"));
89                 text.add(new Panel());
90                 text.add(createLabel(config.getText(IRCTextProvider.ABOUT_SUPPORT)));
91                 text.add(new Panel());
92                 text.add(createLabel(config.getGUIInfoString()));
93                 text.add(new Panel());
94                 text.add(createLabel("http://www.pjirc.com"));
95                 text.add(createLabel("http://www.pjirc.it"));
96                 _aboutFrame.addWindowListener(this);
97                 _aboutFrame.add(text, BorderLayout.CENTER);
98
99                 _aboutFrame.setSize(500, 300);
100                 _aboutFrame.setResizable(false);
101                 _aboutFrame.show();
102         }
103
104         @Override
105         public void windowClosed(WindowEvent e) {
106                 _aboutFrame.removeWindowListener(this);
107                 _aboutFrame = null;
108         }
109
110         @Override
111         public void windowClosing(WindowEvent e) {
112                 _aboutFrame.hide();
113                 _aboutFrame.dispose();
114         }
115 }