KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > memoire > vainstall > xui > XuiReadmePanel


1 /**
2  * $RCSfile: XuiReadmePanel.java,v $
3  * @creation 01/02/00
4  * @modification $Date: 2001/06/12 06:41:39 $
5  */

6
7 package com.memoire.vainstall.xui;
8
9 import java.awt.*;
10 import java.io.*;
11 import java.awt.event.*;
12 import javax.swing.*;
13 import javax.swing.border.*;
14 import com.memoire.vainstall.VAGlobals;
15 import com.memoire.vainstall.VAReadmeStep;
16
17 /**
18  * @version $Id: XuiReadmePanel.java,v 1.5 2001/06/12 06:41:39 westbay Exp $
19  * @author Guillaume Desnoix
20  */

21
22 public class XuiReadmePanel
23        extends XuiAbstractPanel
24        implements VAReadmeStep
25 {
26   JTextArea taLicense_;
27   
28   public XuiReadmePanel()
29   {
30     super();
31     
32     setLayout(new BorderLayout(5,0));
33     setBorder(new EmptyBorder(5,5,5,5));
34
35     JPanel pnMain=new XuiPanel();
36     pnMain.setLayout(new BorderLayout());
37
38     XuiTitle lbTitle=new XuiTitle(VAGlobals.i18n("UI_Readme"),XuiTitle.LEFT);
39     lbTitle.setFont(new Font("SansSerif",Font.PLAIN,16));
40
41     taLicense_=new JTextArea();
42     taLicense_.setBackground(new Color(255,255,224));
43     taLicense_.setBorder(new EmptyBorder(5,5,5,5));
44     taLicense_.setFont(new Font("Monospaced",Font.PLAIN,12));
45     taLicense_.setEditable(false);
46     JScrollPane spLicense=new JScrollPane(taLicense_);
47     spLicense.setBorder(new LineBorder(Color.black,2));
48     spLicense.getVerticalScrollBar().setBackground(Color.black);
49     spLicense.getHorizontalScrollBar().setBackground(Color.black);
50
51     pnMain.add(BorderLayout.NORTH, lbTitle);
52     pnMain.add(BorderLayout.CENTER, spLicense);
53     
54     // JPanel pnImage=XuiImagePanel.IMAGE_PANEL;
55
// pnMain.setPreferredSize(new Dimension(200, pnImage.getPreferredSize().height));
56
// add(pnImage);
57
add(pnMain, BorderLayout.CENTER);
58   }
59
60   public void setText(InputStream lic)
61   {
62     String JavaDoc text="";
63     if( lic==null ) {
64       text += VAGlobals.i18n("UI_NoReadme");
65     } else {
66       try {
67         LineNumberReader in=new LineNumberReader(new InputStreamReader(lic, "UTF-8"));
68         String JavaDoc line=in.readLine();
69         while( line!=null ) {
70           text+=line+"\n";
71           line=in.readLine();
72         }
73         in.close();
74       } catch( IOException e ) {
75         text+=e.getMessage();
76       }
77     }
78     taLicense_.setText(text);
79     taLicense_.setCaretPosition(0);
80   }
81 }
82
Popular Tags