]>
Commit | Line | Data |
---|---|---|
a13899c5 | 1 | /** @file\r |
2 | \r | |
3 | To show a about window with copyright information\r | |
4 | \r | |
5 | Copyright (c) 2006, Intel Corporation\r | |
6 | All rights reserved. This program and the accompanying materials\r | |
7 | are licensed and made available under the terms and conditions of the BSD License\r | |
8 | which accompanies this distribution. The full text of the license may be found at\r | |
9 | http://opensource.org/licenses/bsd-license.php\r | |
10 | \r | |
11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
13 | \r | |
14 | **/\r | |
15 | \r | |
16 | package org.tianocore.frameworkwizard;\r | |
17 | \r | |
18 | import java.awt.event.ActionEvent;\r | |
19 | import java.awt.event.WindowEvent;\r | |
20 | \r | |
21 | import javax.swing.JButton;\r | |
22 | import javax.swing.JLabel;\r | |
23 | import javax.swing.JPanel;\r | |
24 | \r | |
25 | import org.tianocore.frameworkwizard.common.DataType;\r | |
26 | import org.tianocore.frameworkwizard.common.ui.IDialog;\r | |
27 | import org.tianocore.frameworkwizard.common.ui.IFrame;\r | |
79cb6fdb | 28 | import javax.swing.ImageIcon;\r |
a13899c5 | 29 | \r |
30 | /**\r | |
31 | The class is used to show a about window with copyright information\r | |
32 | It extends IDialog\r | |
33 | \r | |
34 | **/\r | |
35 | public class About extends IDialog {\r | |
36 | \r | |
37 | ///\r | |
38 | /// Define class Serial Version UID\r | |
39 | ///\r | |
40 | private static final long serialVersionUID = 2958136136667310962L;\r | |
41 | \r | |
42 | //\r | |
43 | //Define class members\r | |
44 | //\r | |
45 | private JPanel jContentPane = null;\r | |
46 | \r | |
47 | private JLabel jLabel = null;\r | |
48 | \r | |
49 | private JLabel jLabel1 = null;\r | |
50 | \r | |
51 | private JLabel jLabel2 = null;\r | |
52 | \r | |
53 | private JButton jButtonOK = null;\r | |
54 | \r | |
79cb6fdb | 55 | private JLabel jLabelImage = null;\r |
56 | \r | |
a13899c5 | 57 | /**\r |
58 | This method initializes jButtonOK \r | |
59 | \r | |
60 | @return javax.swing.JButton jButtonOK\r | |
61 | \r | |
62 | **/\r | |
63 | private JButton getJButtonOK() {\r | |
64 | if (jButtonOK == null) {\r | |
65 | jButtonOK = new JButton();\r | |
79cb6fdb | 66 | jButtonOK.setBounds(new java.awt.Rectangle(115,200,90,20));\r |
a13899c5 | 67 | jButtonOK.setText("OK");\r |
68 | jButtonOK.addActionListener(this);\r | |
69 | }\r | |
70 | return jButtonOK;\r | |
71 | }\r | |
72 | \r | |
73 | public static void main(String[] args) {\r | |
74 | About a = new About();\r | |
75 | a.setVisible(true);\r | |
76 | }\r | |
77 | \r | |
78 | /**\r | |
79 | This is the default constructor\r | |
80 | \r | |
81 | **/\r | |
82 | public About() {\r | |
83 | super();\r | |
84 | init();\r | |
85 | }\r | |
86 | \r | |
87 | /**\r | |
88 | This is the default constructor\r | |
89 | \r | |
90 | **/\r | |
91 | public About(IFrame parentFrame, boolean modal) {\r | |
92 | super(parentFrame, modal);\r | |
93 | init();\r | |
94 | }\r | |
95 | \r | |
96 | /**\r | |
97 | This method initializes this\r | |
98 | \r | |
99 | **/\r | |
100 | private void init() {\r | |
79cb6fdb | 101 | this.setSize(320, 265);\r |
a13899c5 | 102 | this.setContentPane(getJContentPane());\r |
103 | this.setTitle("About");\r | |
104 | this.getRootPane().setDefaultButton(jButtonOK);\r | |
105 | this.centerWindow();\r | |
106 | }\r | |
107 | \r | |
108 | /**\r | |
109 | This method initializes jContentPane\r | |
110 | \r | |
111 | @return javax.swing.JPanel jContentPane\r | |
112 | \r | |
113 | **/\r | |
114 | private JPanel getJContentPane() {\r | |
115 | if (jContentPane == null) {\r | |
79cb6fdb | 116 | jLabelImage = new JLabel();\r |
117 | jLabelImage.setBounds(new java.awt.Rectangle(63,20,193,58));\r | |
118 | jLabelImage.setIcon(new ImageIcon(getClass().getResource("/resources/images/logo.gif")));\r | |
119 | \r | |
a13899c5 | 120 | jLabel2 = new JLabel();\r |
79cb6fdb | 121 | jLabel2.setBounds(new java.awt.Rectangle(25,160,270,20));\r |
a13899c5 | 122 | jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);\r |
123 | jLabel2.setText("All rights reserved");\r | |
124 | jLabel1 = new JLabel();\r | |
79cb6fdb | 125 | jLabel1.setBounds(new java.awt.Rectangle(25,130,270,20));\r |
a13899c5 | 126 | jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);\r |
127 | jLabel1.setText("Copyright (c) 2006, Intel Corporation");\r | |
128 | jLabel = new JLabel();\r | |
129 | jLabel.setToolTipText("");\r | |
79cb6fdb | 130 | jLabel.setBounds(new java.awt.Rectangle(25,90,270,20));\r |
a13899c5 | 131 | jLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);\r |
8f9acbd7 | 132 | jLabel.setText(DataType.PROJECT_NAME + " " + DataType.PROJECT_VERSION);\r |
a13899c5 | 133 | jContentPane = new JPanel();\r |
134 | jContentPane.setLayout(null);\r | |
79cb6fdb | 135 | jContentPane.setSize(new java.awt.Dimension(320,235));\r |
a13899c5 | 136 | jContentPane.add(jLabel, null);\r |
137 | jContentPane.add(jLabel1, null);\r | |
138 | jContentPane.add(jLabel2, null);\r | |
139 | jContentPane.add(getJButtonOK(), null);\r | |
79cb6fdb | 140 | jContentPane.add(jLabelImage, null);\r |
a13899c5 | 141 | }\r |
142 | return jContentPane;\r | |
143 | }\r | |
144 | \r | |
145 | /* (non-Javadoc)\r | |
146 | * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)\r | |
147 | * \r | |
148 | * Override actionPerformed to listen all actions\r | |
149 | */\r | |
150 | public void actionPerformed(ActionEvent arg0) {\r | |
151 | if (arg0.getSource() == jButtonOK) {\r | |
152 | returnType = DataType.RETURN_TYPE_OK;\r | |
153 | this.setVisible(false);\r | |
154 | }\r | |
155 | }\r | |
156 | \r | |
157 | /**\r | |
158 | Dispose when windows is closing\r | |
159 | \r | |
160 | @param arg0\r | |
161 | \r | |
162 | **/\r | |
163 | public void windowClosing(WindowEvent arg0) {\r | |
164 | this.dispose();\r | |
165 | }\r | |
166 | }\r |