]>
git.proxmox.com Git - mirror_edk2.git/blob - Tools/Source/CreateMdkPkg/src/org/tianocore/packaging/workspace/ui/Welcome.java
3 The file is used to show a welcome page in the process of setup
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
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.
16 package org
.tianocore
.packaging
.workspace
.ui
;
18 import java
.awt
.event
.ActionEvent
;
19 import java
.awt
.event
.ActionListener
;
20 import java
.awt
.event
.WindowEvent
;
22 import javax
.swing
.JButton
;
23 import javax
.swing
.JPanel
;
24 import javax
.swing
.JTextArea
;
26 import org
.tianocore
.packaging
.common
.ui
.IFrame
;
29 The class is used to show a welcome page in the process of setup
31 @since CreateMdkPkg 1.0
34 public class Welcome
extends IFrame
implements ActionListener
{
37 /// Define class Serial Version UID
39 private static final long serialVersionUID
= 8160041311175680637L;
42 // Define class members
44 private JPanel jContentPane
= null;
46 private JPanel jPanel
= null;
48 private JTextArea jTextArea
= null;
50 private JTextArea jTextArea1
= null;
52 private JTextArea jTextArea2
= null;
54 private JTextArea jTextArea3
= null;
56 private JButton jButtonNext
= null;
58 private JButton jButtonCancel
= null;
60 private LicenseAgreement la
= null;
63 This method initializes jPanel
65 @return javax.swing.JPanel jPanel
68 private JPanel
getJPanel() {
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);
85 This method initializes jTextArea
87 @return javax.swing.JTextArea jTextArea
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");
104 This method initializes jTextArea1
106 @return javax.swing.JTextArea jTextArea1
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));
122 This method initializes jTextArea2
124 @return javax.swing.JTextArea jTextArea2
127 private JTextArea
getJTextArea2() {
128 if (jTextArea2
== null) {
129 jTextArea2
= new JTextArea();
130 jTextArea2
.setSize(new java
.awt
.Dimension(495, 50));
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));
142 This method initializes jTextArea3
144 @return javax.swing.JTextArea jTextArea3
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");
159 This method initializes jButtonNext
161 @return javax.swing.JButton jButtonNext
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);
177 This method initializes jButtonCancel
179 @return javax.swing.JButton jButtonCancel
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);
191 return jButtonCancel
;
195 Main class, used for test
199 public static void main(String
[] args
) {
200 Welcome w
= new Welcome();
205 This is the default constructor
214 This method initializes this
217 private void init() {
218 this.setSize(500, 390);
219 this.setContentPane(getJContentPane());
220 this.setTitle("Welcome");
222 this.getRootPane().setDefaultButton(jButtonNext
);
226 This method initializes jContentPane
228 @return javax.swing.JPanel jContentPane
231 private JPanel
getJContentPane() {
232 if (jContentPane
== null) {
233 jContentPane
= new JPanel();
234 jContentPane
.setLayout(null);
235 jContentPane
.add(getJPanel(), null);
241 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
243 * Override actionPerformed to listen all actions
246 public void actionPerformed(ActionEvent arg0
) {
247 Object obj
= arg0
.getSource();
249 // Show next page if click button Next
251 if (obj
== jButtonNext
) {
253 la
= new LicenseAgreement(this);
255 this.setVisible(false);
258 if (obj
== jButtonCancel
) {
264 * @see java.awt.event.WindowListener#windowClosing(java.awt.event.WindowEvent)
266 * Override windowClosing to show confirm quit dialog
269 public void windowClosing(WindowEvent arg0
) {