KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > junit > awtui > AboutDialog


1 package junit.awtui;
2
3 import java.awt.Button JavaDoc;
4 import java.awt.Dialog JavaDoc;
5 import java.awt.Font JavaDoc;
6 import java.awt.Frame JavaDoc;
7 import java.awt.GridBagConstraints JavaDoc;
8 import java.awt.GridBagLayout JavaDoc;
9 import java.awt.Insets JavaDoc;
10 import java.awt.Label JavaDoc;
11 import java.awt.event.ActionEvent JavaDoc;
12 import java.awt.event.ActionListener JavaDoc;
13 import java.awt.event.WindowAdapter JavaDoc;
14 import java.awt.event.WindowEvent JavaDoc;
15
16 import junit.runner.Version;
17
18 class AboutDialog extends Dialog JavaDoc {
19     public AboutDialog(Frame JavaDoc parent) {
20         super(parent);
21         
22         setResizable(false);
23         setLayout(new GridBagLayout JavaDoc());
24         setSize(330, 138);
25         setTitle("About");
26         
27         Button JavaDoc button= new Button JavaDoc("Close");
28         button.addActionListener(
29             new ActionListener JavaDoc() {
30                 public void actionPerformed(ActionEvent JavaDoc e) {
31                     dispose();
32                 }
33             }
34         );
35         
36         Label JavaDoc label1= new Label JavaDoc("JUnit");
37         label1.setFont(new Font JavaDoc("dialog", Font.PLAIN, 36));
38         
39         Label JavaDoc label2= new Label JavaDoc("JUnit "+Version.id()+ " by Kent Beck and Erich Gamma");
40         label2.setFont(new Font JavaDoc("dialog", Font.PLAIN, 14));
41         
42         Logo logo= new Logo();
43
44         GridBagConstraints JavaDoc constraintsLabel1= new GridBagConstraints JavaDoc();
45         constraintsLabel1.gridx = 3; constraintsLabel1.gridy = 0;
46         constraintsLabel1.gridwidth = 1; constraintsLabel1.gridheight = 1;
47         constraintsLabel1.anchor = GridBagConstraints.CENTER;
48         add(label1, constraintsLabel1);
49
50         GridBagConstraints JavaDoc constraintsLabel2= new GridBagConstraints JavaDoc();
51         constraintsLabel2.gridx = 2; constraintsLabel2.gridy = 1;
52         constraintsLabel2.gridwidth = 2; constraintsLabel2.gridheight = 1;
53         constraintsLabel2.anchor = GridBagConstraints.CENTER;
54         add(label2, constraintsLabel2);
55
56         GridBagConstraints JavaDoc constraintsButton1= new GridBagConstraints JavaDoc();
57         constraintsButton1.gridx = 2; constraintsButton1.gridy = 2;
58         constraintsButton1.gridwidth = 2; constraintsButton1.gridheight = 1;
59         constraintsButton1.anchor = GridBagConstraints.CENTER;
60         constraintsButton1.insets= new Insets JavaDoc(8, 0, 8, 0);
61         add(button, constraintsButton1);
62
63         GridBagConstraints JavaDoc constraintsLogo1= new GridBagConstraints JavaDoc();
64         constraintsLogo1.gridx = 2; constraintsLogo1.gridy = 0;
65         constraintsLogo1.gridwidth = 1; constraintsLogo1.gridheight = 1;
66         constraintsLogo1.anchor = GridBagConstraints.CENTER;
67         add(logo, constraintsLogo1);
68
69         addWindowListener(
70             new WindowAdapter JavaDoc() {
71                 public void windowClosing(WindowEvent JavaDoc e) {
72                     dispose();
73                 }
74             }
75         );
76     }
77 }
Popular Tags