KickJava   Java API By Example, From Geeks To Geeks.

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


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
27
28 package net.yagga.miniinstaller.gui;
29
30 import java.awt.*;
31 import javax.swing.*;
32 import net.yagga.util.Ut;
33
34 /**
35  * Displays text files as read from a file
36  * @author Walter Gamba
37  */

38 public class DisplayPanel extends JPanel implements InstallPanel {
39   BorderLayout borderLayout1 = new BorderLayout();
40   JScrollPane jScrollPane1 = new JScrollPane();
41   JTextArea taText = new JTextArea();
42
43   String JavaDoc text="";
44   public DisplayPanel(String JavaDoc text) {
45     this.text=text;
46     try {
47       jbInit();
48     }
49     catch (Exception JavaDoc ex) {
50       ex.printStackTrace();
51     }
52   }
53
54   void jbInit() throws Exception JavaDoc {
55         this.setPreferredSize(InstallFrame.panelDim);
56     taText.setText(text);
57     taText.setWrapStyleWord(true);
58     taText.setLineWrap(true);
59     this.setLayout(borderLayout1);
60     this.add(jScrollPane1, BorderLayout.CENTER);
61     jScrollPane1.getViewport().add(taText,null);
62     refresh();
63   }
64
65   public void refresh(){
66     this.setBackground(InstallFrame.BK_COL);
67     this.setMaximumSize(InstallFrame.panelDim);
68     this.setPreferredSize(InstallFrame.panelDim);
69     this.setMinimumSize(InstallFrame.panelDim);
70     taText.setCaretPosition(0);
71       taText.setForeground(InstallFrame.FG_COL);
72         this.invalidate();
73   }
74
75 }
76
77
Popular Tags