]> git.proxmox.com Git - mirror_edk2.git/blob - Tools/Source/CreateMdkPkg/src/org/tianocore/packaging/workspace/ui/Welcome.java
aa2e5861be0c35864f23dbbb7165584ba5e3532d
[mirror_edk2.git] / Tools / Source / CreateMdkPkg / src / org / tianocore / packaging / workspace / ui / Welcome.java
1 /** @file
2
3 The file is used to show a welcome page in the process of setup
4
5 Copyright (c) 2006, Intel Corporation
6 All rights reserved. This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
10
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13
14 **/
15
16 package org.tianocore.packaging.workspace.ui;
17
18 import java.awt.event.ActionEvent;
19 import java.awt.event.ActionListener;
20 import java.awt.event.WindowEvent;
21
22 import javax.swing.JButton;
23 import javax.swing.JPanel;
24 import javax.swing.JTextArea;
25
26 import org.tianocore.packaging.common.ui.IFrame;
27
28 /**
29 The class is used to show a welcome page in the process of setup
30
31 @since CreateMdkPkg 1.0
32
33 **/
34 public class Welcome extends IFrame implements ActionListener {
35
36 ///
37 /// Define class Serial Version UID
38 ///
39 private static final long serialVersionUID = 8160041311175680637L;
40
41 //
42 // Define class members
43 //
44 private JPanel jContentPane = null;
45
46 private JPanel jPanel = null;
47
48 private JTextArea jTextArea = null;
49
50 private JTextArea jTextArea1 = null;
51
52 private JTextArea jTextArea2 = null;
53
54 private JTextArea jTextArea3 = null;
55
56 private JButton jButtonNext = null;
57
58 private JButton jButtonCancel = null;
59
60 private LicenseAgreement la = null;
61
62 /**
63 This method initializes jPanel
64
65 @return javax.swing.JPanel jPanel
66
67 **/
68 private JPanel getJPanel() {
69 if (jPanel == null) {
70 jPanel = new JPanel();
71 jPanel.setLayout(null);
72 jPanel.setSize(new java.awt.Dimension(495, 355));
73 jPanel.setLocation(new java.awt.Point(0, 0));
74 jPanel.add(getJTextArea(), null);
75 jPanel.add(getJTextArea1(), null);
76 jPanel.add(getJTextArea2(), null);
77 jPanel.add(getJTextArea3(), null);
78 jPanel.add(getJButtonNext(), null);
79 jPanel.add(getJButtonCancel(), null);
80 }
81 return jPanel;
82 }
83
84 /**
85 This method initializes jTextArea
86
87 @return javax.swing.JTextArea jTextArea
88
89 **/
90 private JTextArea getJTextArea() {
91 if (jTextArea == null) {
92 jTextArea = new JTextArea();
93 jTextArea.setFont(new java.awt.Font("Times New Roman", java.awt.Font.BOLD, 24));
94 jTextArea.setSize(new java.awt.Dimension(495, 70));
95 jTextArea.setLocation(new java.awt.Point(0, 0));
96 jTextArea.setEnabled(true);
97 jTextArea.setEditable(false);
98 jTextArea.setText("Welcome to the MDK Package Setup Wizard");
99 }
100 return jTextArea;
101 }
102
103 /**
104 This method initializes jTextArea1
105
106 @return javax.swing.JTextArea jTextArea1
107
108 **/
109 private JTextArea getJTextArea1() {
110 if (jTextArea1 == null) {
111 jTextArea1 = new JTextArea();
112 jTextArea1.setText("This will install MDK Package on your computer. ");
113 jTextArea1.setSize(new java.awt.Dimension(495, 40));
114 jTextArea1.setEnabled(true);
115 jTextArea1.setEditable(false);
116 jTextArea1.setLocation(new java.awt.Point(0, 70));
117 }
118 return jTextArea1;
119 }
120
121 /**
122 This method initializes jTextArea2
123
124 @return javax.swing.JTextArea jTextArea2
125
126 **/
127 private JTextArea getJTextArea2() {
128 if (jTextArea2 == null) {
129 jTextArea2 = new JTextArea();
130 jTextArea2.setSize(new java.awt.Dimension(495, 50));
131 jTextArea2
132 .setText("It is strongly recommended that you exit all other programs before running this installation program.");
133 jTextArea2.setLineWrap(true);
134 jTextArea2.setEnabled(true);
135 jTextArea2.setEditable(false);
136 jTextArea2.setLocation(new java.awt.Point(0, 110));
137 }
138 return jTextArea2;
139 }
140
141 /**
142 This method initializes jTextArea3
143
144 @return javax.swing.JTextArea jTextArea3
145
146 **/
147 private JTextArea getJTextArea3() {
148 if (jTextArea3 == null) {
149 jTextArea3 = new JTextArea();
150 jTextArea3.setBounds(new java.awt.Rectangle(0, 160, 495, 150));
151 jTextArea3.setEnabled(true);
152 jTextArea3.setEditable(false);
153 jTextArea3.setText("Click Nex to continue. Or click Cancel to exit Setup");
154 }
155 return jTextArea3;
156 }
157
158 /**
159 This method initializes jButtonNext
160
161 @return javax.swing.JButton jButtonNext
162
163 **/
164 private JButton getJButtonNext() {
165 if (jButtonNext == null) {
166 jButtonNext = new JButton();
167 jButtonNext.setText("Next");
168 jButtonNext.setSize(new java.awt.Dimension(90, 20));
169 jButtonNext.setLocation(new java.awt.Point(290, 320));
170 jButtonNext.setMnemonic('N');
171 jButtonNext.addActionListener(this);
172 }
173 return jButtonNext;
174 }
175
176 /**
177 This method initializes jButtonCancel
178
179 @return javax.swing.JButton jButtonCancel
180
181 **/
182 private JButton getJButtonCancel() {
183 if (jButtonCancel == null) {
184 jButtonCancel = new JButton();
185 jButtonCancel.setText("Cancel");
186 jButtonCancel.setSize(new java.awt.Dimension(90, 20));
187 jButtonCancel.setLocation(new java.awt.Point(390, 320));
188 jButtonCancel.setMnemonic('C');
189 jButtonCancel.addActionListener(this);
190 }
191 return jButtonCancel;
192 }
193
194 /**
195 Main class, used for test
196
197 @param args
198 **/
199 public static void main(String[] args) {
200 Welcome w = new Welcome();
201 w.setVisible(true);
202 }
203
204 /**
205 This is the default constructor
206
207 **/
208 public Welcome() {
209 super();
210 init();
211 }
212
213 /**
214 This method initializes this
215
216 **/
217 private void init() {
218 this.setSize(500, 390);
219 this.setContentPane(getJContentPane());
220 this.setTitle("Welcome");
221 this.centerWindow();
222 this.getRootPane().setDefaultButton(jButtonNext);
223 }
224
225 /**
226 This method initializes jContentPane
227
228 @return javax.swing.JPanel jContentPane
229
230 **/
231 private JPanel getJContentPane() {
232 if (jContentPane == null) {
233 jContentPane = new JPanel();
234 jContentPane.setLayout(null);
235 jContentPane.add(getJPanel(), null);
236 }
237 return jContentPane;
238 }
239
240 /* (non-Javadoc)
241 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
242 *
243 * Override actionPerformed to listen all actions
244 *
245 */
246 public void actionPerformed(ActionEvent arg0) {
247 Object obj = arg0.getSource();
248 //
249 // Show next page if click button Next
250 //
251 if (obj == jButtonNext) {
252 if (la == null) {
253 la = new LicenseAgreement(this);
254 }
255 this.setVisible(false);
256 la.setVisible(true);
257 }
258 if (obj == jButtonCancel) {
259 this.onExit();
260 }
261 }
262
263 /* (non-Javadoc)
264 * @see java.awt.event.WindowListener#windowClosing(java.awt.event.WindowEvent)
265 *
266 * Override windowClosing to show confirm quit dialog
267 *
268 */
269 public void windowClosing(WindowEvent arg0) {
270 this.onExit();
271 }
272 }