KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > yagga > miniinstaller > gui > FinalPanel


1 /*
2  * This file is part of MiniInstaller, a self installer builder for Java
3  * Copyright (C) 2002 Walter Gamba
4  * mailto:walter@yagga.net
5  * http://www.yagga.net/java/miniinstaller
6  *
7  * MiniInstaller is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * MiniInstaller is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20  *
21  * As the time of writing, the GNU General Public Licene can be
22  * found at http://www.gnu.org/licenses/gpl.txt
23  *
24  */

25
26 package net.yagga.miniinstaller.gui;
27
28 import java.awt.*;
29 import java.io.*;
30 import javax.swing.*;
31 import java.awt.event.*;
32 import net.yagga.util.Ut;
33
34 public class FinalPanel extends WritePanel
35   implements ActionListener {
36
37   private String JavaDoc shellCaption;
38
39   private FinalExecuter fExec;
40   BorderLayout borderLayout1 = new BorderLayout();
41   Box box1;
42   JCheckBox ckLaunch = new JCheckBox();
43   JLabel jLabel1 = new JLabel();
44
45   public FinalPanel(FinalExecuter fExec, String JavaDoc title, String JavaDoc msg, String JavaDoc shellCaption){
46     super(title,msg,null);
47     this.fExec=fExec;
48     this.shellCaption=shellCaption;
49         try {
50       jbInit2();
51     }
52     catch (Exception JavaDoc ex) {
53       ex.printStackTrace();
54     }
55   }
56
57   private void jbInit2() throws Exception JavaDoc {
58     super.jbInit();
59         box1 = Box.createVerticalBox();
60         if(shellCaption!=null){
61             Box box=Box.createHorizontalBox();
62             ckLaunch.setAlignmentX((float) 1.0);
63             ckLaunch.setHorizontalAlignment(SwingConstants.CENTER);
64             //ckLaunch.setHorizontalTextPosition(SwingConstants.CENTER);
65
ckLaunch.setText("");
66             jLabel1.setAlignmentX((float) 0.5);
67             jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
68             jLabel1.setHorizontalTextPosition(SwingConstants.CENTER);
69             jLabel1.setText("Check here to execute on exit:");
70           jLabel1.setFont(GuiProperties.textFont);
71
72             this.add(box, BorderLayout.CENTER);
73             this.add(box1, BorderLayout.SOUTH);
74             box1.add(jLabel1, null);
75             box1.add(ckLaunch, null);
76             ckLaunch.setText(shellCaption);
77             ckLaunch.addActionListener(this);
78             ckLaunch.setOpaque(false);
79             ckLaunch.setFont(GuiProperties.makeBold(GuiProperties.textFont));
80         }
81   }
82
83     public void refresh(){
84         super.refresh();
85         if(ckLaunch!=null)
86           ckLaunch.setForeground(InstallFrame.FG_COL);
87         if(jLabel1!=null)
88           jLabel1.setForeground(InstallFrame.FG_COL);
89     }
90
91   public void actionPerformed(ActionEvent e){
92     if(e.getSource()==ckLaunch)
93         fExec.executeShellOnExit(ckLaunch.isSelected());
94   }
95
96 }
Popular Tags