KickJava   Java API By Example, From Geeks To Geeks.

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


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 import com.borland.jbcl.layout.*;
31 import net.yagga.util.Ut;
32
33 public class TitlePanel extends JPanel {
34   JLabel lbTitle = new JLabel();
35   JSeparator spSep=new JSeparator(SwingConstants.HORIZONTAL);
36
37   String JavaDoc title;
38
39   GridBagLayout gridBagLayout1 = new GridBagLayout();
40   JLabel shadow = new JLabel();
41
42     JPanel thisPanel=null;
43   public TitlePanel(String JavaDoc title) {
44     this.title=title;
45         thisPanel=this;
46     try {
47       jbInit();
48     }
49     catch (Exception JavaDoc ex) {
50       ex.printStackTrace();
51     }
52   }
53
54   void jbInit() throws Exception JavaDoc {
55
56     this.setOpaque(true);
57
58     lbTitle.setText(title);
59     lbTitle.setOpaque(false);
60
61         this.setBackground(SystemColor.control);
62     lbTitle.setFont(GuiProperties.titleFont);
63
64         lbTitle.setForeground(InstallFrame.TITLE_COL);
65
66     javax.swing.border.EtchedBorder JavaDoc eBorder=new javax.swing.border.EtchedBorder JavaDoc();
67     spSep.setBorder(eBorder);
68     spSep.setPreferredSize(new Dimension(0, 1));
69
70     this.setLayout(gridBagLayout1);
71     /*
72         shadow.setText("Testo");
73     shadow.setForeground(Color.darkGray);
74     shadow.setOpaque(false);
75     shadow.setFont(GuiProperties.titleFont);
76     */

77         this.add(spSep, new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0
78             ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 10, 3, 10), 100, 1));
79     this.add(lbTitle, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0
80             ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 10, 0, 10), 100, 0));
81     setTitle(title);
82         this.setBackground(InstallFrame.BK_COL);
83
84         lbTitle.setText("M:)");
85
86         this.setMinimumSize(new Dimension(100, 30));
87         this.setPreferredSize(new Dimension(100,(int)getPreferredSize().getHeight()));
88     //this.setMaximumSize(new Dimension(2000, 200));
89
}
90   void setTitle(String JavaDoc title){
91         this.title=title;
92     lbTitle.setText(title);
93         //shadow.setText(title);
94
}
95
96   public void refresh(){
97
98         try {
99      jbInit();
100     }
101     catch (Exception JavaDoc ex) {
102       ex.printStackTrace();
103     }
104   }
105
106
107 }
108
109
110
Popular Tags