KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > edu > neu > ccs > jmk > swing > AboutDG


1 // $Id: AboutDG.java,v 1.3 2002/01/28 13:06:31 ramsdell Exp $
2

3 /*
4  * Copyright 1999 by Olivier Refalo
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19  */

20 package edu.neu.ccs.jmk.swing;
21
22 import javax.swing.*;
23 import javax.swing.border.*;
24 import java.awt.event.*;
25 import java.awt.*;
26
27 import edu.neu.ccs.jmk.Make;
28
29 final public
30 class AboutDG
31 extends JDialog {
32
33     /** Initializes the Form */
34     public AboutDG(java.awt.Frame JavaDoc parent, boolean modal) {
35         super (parent, modal);
36         initComponents ();
37         pack ();
38
39         // Center window
40
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
41         Dimension windowSize = getSize();
42         setBounds( (screenSize.width-windowSize.width)/2,
43                    (screenSize.height-windowSize.height)/2, windowSize.width, windowSize.height);
44
45     }
46
47     private void initComponents () {
48
49         setTitle ("About Jmk");
50         setBackground (java.awt.Color.white);
51         addWindowListener (new WindowAdapter () {
52                                public void windowClosing (WindowEvent evt) {
53                                    closeDialog (evt);
54                                }
55                            }
56                           );
57         getContentPane ().setLayout (new java.awt.BorderLayout JavaDoc ());
58
59         bottomPL = new JPanel ();
60         bottomPL.setBackground (java.awt.Color.white);
61         bottomPL.setLayout (new java.awt.FlowLayout JavaDoc ());
62
63         okBT = new JButton ();
64         okBT.setText ("Ok");
65         okBT.addActionListener (new ActionListener () {
66                                     public void actionPerformed (ActionEvent evt) {
67                                         okBTActionPerformed (evt);
68                                     }
69                                 }
70                                );
71         bottomPL.add (okBT);
72
73         getContentPane ().add (bottomPL, "South");
74
75         textSP = new JScrollPane ();
76         textSP.setBackground (java.awt.Color.white);
77         textSP.setBorder (new EmptyBorder (new java.awt.Insets JavaDoc(5, 5, 5, 5)));
78
79         textTP = new JTextPane ();
80         textTP.setText (Make.getVersion()+"\n\nCopyright 1998-1999 by John D. Ramsdell\nSwing GUI by Olivier Refalo\n\nThis program is free software; you can redistribute it and/or\nmodify it under the terms of the GNU Lesser General Public License\nas published by the Free Software Foundation; either version 2\nof the License, or (at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU Lesser General Public License for more details.\n\nYou should have received a copy of the GNU Lesser General Public License\nalong with this program; if not, write to the Free Software\nFoundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\n");
81         textTP.setEditable (false);
82         textSP.add (textTP);
83
84         textSP.setViewportView (textTP);
85         getContentPane ().add (textSP, "Center");
86
87         leftPL = new JPanel ();
88         leftPL.setBackground (java.awt.Color.white);
89         leftPL.setLayout (new java.awt.FlowLayout JavaDoc ());
90
91         logoLB = new JLabel ();
92         logoLB.setIcon (new ImageIcon (getClass ().getResource ("/edu/neu/ccs/jmk/swing/gfx/jmklogo.gif")));
93         logoLB.setDisabledIcon ((Icon) null);
94         leftPL.add (logoLB);
95
96         getContentPane ().add (leftPL, "West");
97
98     }
99
100     private void okBTActionPerformed (ActionEvent evt) {
101         setVisible (false);
102         dispose ();
103     }
104
105     /** Closes the dialog */
106     private void closeDialog(WindowEvent evt) {
107         setVisible (false);
108         dispose ();
109     }
110
111     private JPanel bottomPL;
112     private JScrollPane textSP;
113     private JPanel leftPL;
114     private JButton okBT;
115     private JTextPane textTP;
116     private JLabel logoLB;
117
118 }
119
Popular Tags