3 The file is used to show a Finish page in the last step 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
.JFrame
;
24 import javax
.swing
.JLabel
;
25 import javax
.swing
.JPanel
;
26 import javax
.swing
.JScrollPane
;
27 import javax
.swing
.JTextArea
;
29 import org
.tianocore
.packaging
.common
.ui
.IFrame
;
32 The class is used to show a Finish page in the last step of setup
34 @since CreateMdkPkg 1.0
37 public class Finish
extends IFrame
implements ActionListener
{
40 /// Define class Serial Version UID
42 private static final long serialVersionUID
= 9055339173915836187L;
45 // Define class members
47 private JPanel jContentPane
= null;
49 private JTextArea jTextAreaTitle
= null;
51 private JTextArea jTextAreaContent
= null;
53 private JPanel jPanel
= null;
55 private JButton jButtonFinish
= null;
57 private JLabel jLabel
= null;
59 private JLabel jLabel1
= null;
61 private JScrollPane jScrollPane
= null;
63 private JTextArea jTextAreaComment
= null;
65 private String strInstallDir
= "";
68 This method initializes jTextAreaTitle
70 @return javax.swing.JTextArea jTextAreaTitle
73 private JTextArea
getJTextAreaTitle() {
74 if (jTextAreaTitle
== null) {
75 jTextAreaTitle
= new JTextArea();
76 jTextAreaTitle
.setLocation(new java
.awt
.Point(0, 0));
77 jTextAreaTitle
.setText(" Click button \"Install\" to start installation");
78 jTextAreaTitle
.setFont(new java
.awt
.Font("Dialog", java
.awt
.Font
.BOLD
, 14));
79 jTextAreaTitle
.setEditable(false);
80 jTextAreaTitle
.setSize(new java
.awt
.Dimension(495, 20));
82 return jTextAreaTitle
;
86 This method initializes jTextAreaContent
88 @return javax.swing.JTextArea jTextAreaContent
91 private JTextArea
getJTextAreaContent() {
92 if (jTextAreaContent
== null) {
93 jTextAreaContent
= new JTextArea();
94 jTextAreaContent
.setLocation(new java
.awt
.Point(0, 20));
95 jTextAreaContent
.setText("");
96 jTextAreaContent
.setEditable(false);
97 jTextAreaContent
.setSize(new java
.awt
.Dimension(495, 35));
99 return jTextAreaContent
;
103 This method initializes jPanel
105 @return javax.swing.JPanel jPanel
108 private JPanel
getJPanel() {
109 if (jPanel
== null) {
110 jLabel1
= new JLabel();
112 jLabel1
.setLocation(new java
.awt
.Point(30, 40));
113 jLabel1
.setSize(new java
.awt
.Dimension(435, 20));
114 jLabel
= new JLabel();
116 jLabel
.setLocation(new java
.awt
.Point(30, 15));
117 jLabel
.setSize(new java
.awt
.Dimension(435, 20));
118 jPanel
= new JPanel();
119 jPanel
.setLayout(null);
120 jPanel
.setBorder(javax
.swing
.BorderFactory
.createBevelBorder(javax
.swing
.border
.BevelBorder
.LOWERED
));
121 jPanel
.setSize(new java
.awt
.Dimension(494, 251));
122 jPanel
.setLocation(new java
.awt
.Point(0, 55));
123 jPanel
.add(jLabel
, null);
124 jPanel
.add(jLabel1
, null);
125 jPanel
.add(getJScrollPane(), null);
131 This method initializes jButtonFinish
133 @return javax.swing.JButton jButtonFinish
136 private JButton
getJButtonCancel() {
137 if (jButtonFinish
== null) {
138 jButtonFinish
= new JButton();
139 jButtonFinish
.setText("Finish");
140 jButtonFinish
.setBounds(new java
.awt
.Rectangle(360, 315, 90, 20));
141 jButtonFinish
.setEnabled(true);
142 jButtonFinish
.setSelected(false);
143 jButtonFinish
.setMnemonic('C');
144 jButtonFinish
.addActionListener(this);
146 return jButtonFinish
;
150 This method initializes jScrollPane
152 @return javax.swing.JScrollPane jScrollPane
155 private JScrollPane
getJScrollPane() {
156 if (jScrollPane
== null) {
157 jScrollPane
= new JScrollPane();
158 jScrollPane
.setLocation(new java
.awt
.Point(30, 65));
159 jScrollPane
.setSize(new java
.awt
.Dimension(435, 180));
160 jScrollPane
.setViewportView(getJTextAreaComment());
166 This method initializes jTextAreaComment
168 @return javax.swing.JTextArea jTextAreaComment
171 private JTextArea
getJTextAreaComment() {
172 if (jTextAreaComment
== null) {
173 jTextAreaComment
= new JTextArea();
174 jTextAreaComment
.setEditable(false);
175 jTextAreaComment
.setLineWrap(true);
176 jTextAreaComment
.setWrapStyleWord(false);
178 return jTextAreaComment
;
182 Main class, used for test
186 public static void main(String
[] args
) {
187 Finish f
= new Finish();
192 This is the override constructor
194 @param InstallDir The install target dir
197 public Finish(String InstallDir
) {
199 this.strInstallDir
= InstallDir
;
204 This is the default constructor
213 This method initializes this
216 private void init() {
217 this.setSize(500, 390);
219 this.setContentPane(getJContentPane());
220 this.setTitle("Setup - Installing");
222 this.getRootPane().setDefaultButton(jButtonFinish
);
227 This method initializes jContentPane
229 @return javax.swing.JPanel jContentPane
232 private JPanel
getJContentPane() {
233 if (jContentPane
== null) {
234 jContentPane
= new JPanel();
235 jContentPane
.setLayout(null);
236 jContentPane
.setBorder(javax
.swing
.BorderFactory
.createBevelBorder(javax
.swing
.border
.BevelBorder
.RAISED
));
237 jContentPane
.add(getJTextAreaTitle(), null);
238 jContentPane
.add(getJTextAreaContent(), null);
239 jContentPane
.add(getJPanel(), null);
240 jContentPane
.add(getJButtonCancel(), null);
246 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
248 * Override actionPerformed to listen all actions
251 public void actionPerformed(ActionEvent arg0
) {
252 Object obj
= arg0
.getSource();
254 if (obj
== jButtonFinish
) {
261 Change all message values to Finish contents.
264 private void switchFinish() {
265 this.setTitle("Setup - Finish");
266 jTextAreaTitle
.setText(" Congratulations");
267 jTextAreaContent
.setText(" Your workspace was installed!");
268 jLabel
.setText("The MDK package was installed successfully");
269 jLabel1
.setText("Now you can start the trip with EFI");
270 jTextAreaComment
.setText("Please add \"WORKSPACE=" + this.strInstallDir
271 + "\" into your system environment variable");
272 jButtonFinish
.setEnabled(true);
273 this.setDefaultCloseOperation(JFrame
.EXIT_ON_CLOSE
);
274 jButtonFinish
.setText("Finish");
277 // private void switchInstall() {
278 // jTextAreaTitle.setText(" Installation is in process...");
279 // jLabel.setText("The MDK package was being installed...");
280 // jLabel1.setText("Just waiting for a second");
281 // jButtonFinish.setEnabled(false);
282 // jButtonFinish.setText("Finish");
286 * @see java.awt.event.WindowListener#windowClosing(java.awt.event.WindowEvent)
288 * Override windowClosing to exit directly
291 public void windowClosing(WindowEvent arg0
) {