KickJava   Java API By Example, From Geeks To Geeks.

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


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 javax.swing.*;
30
31 /**
32  * A panel that displays a progress bar.. used for Unzipping and copying..
33  * @author Walter Gamba
34  * @version 1.0
35  */

36 public class UnzipPanel extends JPanel implements InstallPanel{
37   JLabel lbTitle = new JLabel();
38   JLabel lbZipFile = new JLabel();
39   JLabel lbDest = new JLabel();
40   JProgressBar pbProgress = new JProgressBar();
41
42
43   String JavaDoc descr, zipFile, destDir;
44   CanFwdListener canFwdListener;
45   GridBagLayout gridBagLayout1 = new GridBagLayout();
46
47   public UnzipPanel(String JavaDoc descr, String JavaDoc zipFile, String JavaDoc destDir, CanFwdListener cfl) {
48     this.canFwdListener=cfl;
49     this.descr=descr;
50     this.zipFile=zipFile;
51     this.destDir=destDir;
52     try {
53       jbInit();
54     }
55     catch (Exception JavaDoc ex) {
56       ex.printStackTrace();
57     }
58   }
59
60   void jbInit() throws Exception JavaDoc {
61     this.setBackground(SystemColor.control);
62     this.setLayout(gridBagLayout1);
63 // lbTitle.setText("titl");
64
lbTitle.setOpaque(false);
65     lbTitle.setFont(GuiProperties.smallTitleFont);
66     lbTitle.setText("titlt");
67     lbTitle.setForeground(InstallFrame.FG_COL);
68 // lbZipFile.setText("srcg");
69
lbZipFile.setOpaque(false);
70     lbZipFile.setText("zipfile");
71     lbZipFile.setForeground(InstallFrame.FG_COL);
72         lbZipFile.setFont(GuiProperties.makeItalic(GuiProperties.textFont));
73 // lbDest.setText("dest");
74
lbDest.setOpaque(false);
75     lbDest.setText("dest");
76     lbDest.setForeground(InstallFrame.FG_COL);
77         lbDest.setFont(GuiProperties.makeItalic(GuiProperties.textFont));
78     pbProgress.setForeground(SystemColor.controlLtHighlight);
79     pbProgress.setDoubleBuffered(true);
80     pbProgress.setOpaque(false);
81     this.add(lbTitle, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0
82             ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(10, 10, 0, 10), 358, 3));
83
84     this.add(lbZipFile, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0
85             ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(32, 10, 0, 10), 250, 0)); //348
86
this.add(lbDest, new GridBagConstraints(0, 2, 1, 1, 1.0, 0.0
87             ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(14, 10, 0, 10), 250, 0)); //348
88
this.add(pbProgress, new GridBagConstraints(0, 3, 1, 1, 1.0, 0.0
89             ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(10, 10, 10, 10), 250, 1)); //220
90
refresh();
91   }
92
93   public void refresh(){
94         this.setMaximumSize(InstallFrame.panelDim);
95     this.setPreferredSize(InstallFrame.panelDim);
96     this.setMinimumSize(InstallFrame.panelDim);
97
98         lbTitle.setText(descr);
99     lbZipFile.setText(zipFile);
100     lbDest.setText(destDir);
101     pbProgress.setValue(0);
102     this.setBackground(InstallFrame.BK_COL);
103     lbTitle.setForeground(InstallFrame.TIT_COL);
104     lbZipFile.setForeground(InstallFrame.FG_COL);
105     lbDest.setForeground(InstallFrame.FG_COL);
106     this.invalidate();
107   }
108
109   void setProgress(int i){
110     pbProgress.setValue(i);
111     if(i==net.yagga.miniinstaller.MiniInstaller.UNZIP_DONE)
112       canFwdListener.canFwd();
113   }
114
115
116 }
117
118
119
Popular Tags