KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > gjt > jclasslib > browser > BrowserAboutDialog


1 /*
2     This library is free software; you can redistribute it and/or
3     modify it under the terms of the GNU General Public
4     License as published by the Free Software Foundation; either
5     version 2 of the license, or (at your option) any later version.
6 */

7
8 package org.gjt.jclasslib.browser;
9
10 import org.gjt.jclasslib.util.GUIHelper;
11
12 import javax.swing.*;
13 import java.awt.*;
14 import java.awt.event.ActionEvent JavaDoc;
15 import java.awt.event.ActionListener JavaDoc;
16
17 /**
18  * About dialog.
19  *
20  * @author <a HREF="mailto:jclasslib@ej-technologies.com">Ingo Kegel</a>
21  * @version $Revision: 1.2 $ $Date: 2005/01/14 15:01:03 $
22  */

23 public class BrowserAboutDialog extends JDialog {
24
25     private JButton btnOk;
26
27     /**
28      * Constructor.
29      *
30      * @param parent parent frame.
31      */

32     public BrowserAboutDialog(JFrame parent) {
33         super(parent);
34         setupControls();
35         setupComponent();
36     }
37
38     private void setupComponent() {
39
40         setModal(true);
41         setTitle("About the jclasslib bytecode viewer");
42         setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
43         setSize(400, 250);
44         GUIHelper.centerOnParentWindow(this, getOwner());
45
46         JComponent contentPane = (JComponent)getContentPane();
47         contentPane.setLayout(new GridBagLayout());
48         GridBagConstraints gc = new GridBagConstraints();
49         gc.insets = new Insets(10, 5, 0, 5);
50         gc.gridx = 0;
51         gc.gridy = GridBagConstraints.RELATIVE;
52
53         gc.anchor = GridBagConstraints.CENTER;
54         gc.weightx = 1;
55
56         JLabel label = new JLabel("jclasslib bytecode viewer");
57         label.setFont(label.getFont().deriveFont(Font.BOLD));
58         contentPane.add(label, gc);
59         gc.insets.top = 5;
60         contentPane.add(new JLabel("Version " + BrowserApplication.APPLICATION_VERSION), gc);
61         contentPane.add(new JLabel("Copyright ej-technologies GmbH, 2001-2005"), gc);
62         contentPane.add(new JLabel("Licensed under the General Public License"), gc);
63
64         gc.weighty = 0;
65         gc.insets.top = 20;
66         gc.insets.bottom = 5;
67         gc.fill = GridBagConstraints.NONE;
68         contentPane.add(btnOk, gc);
69
70         Dimension size = contentPane.getPreferredSize();
71         size.width += 100;
72         contentPane.setPreferredSize(size);
73         pack();
74         setResizable(false);
75
76     }
77
78     private void setupControls() {
79
80         btnOk = new JButton("Ok");
81         btnOk.addActionListener(new ActionListener JavaDoc() {
82             public void actionPerformed(ActionEvent JavaDoc event) {
83                 setVisible(false);
84                 dispose();
85             }
86         });
87     }
88 }
89
Popular Tags