01: /**
02: * $RCSfile: XuiReadmePanel.java,v $
03: * @creation 01/02/00
04: * @modification $Date: 2001/06/12 06:41:39 $
05: */package com.memoire.vainstall.xui;
06:
07: import java.awt.*;
08: import java.io.*;
09: import java.awt.event.*;
10: import javax.swing.*;
11: import javax.swing.border.*;
12: import com.memoire.vainstall.VAGlobals;
13: import com.memoire.vainstall.VAReadmeStep;
14:
15: /**
16: * @version $Id: XuiReadmePanel.java,v 1.5 2001/06/12 06:41:39 westbay Exp $
17: * @author Guillaume Desnoix
18: */
19:
20: public class XuiReadmePanel extends XuiAbstractPanel implements
21: VAReadmeStep {
22: JTextArea taLicense_;
23:
24: public XuiReadmePanel() {
25: super ();
26:
27: setLayout(new BorderLayout(5, 0));
28: setBorder(new EmptyBorder(5, 5, 5, 5));
29:
30: JPanel pnMain = new XuiPanel();
31: pnMain.setLayout(new BorderLayout());
32:
33: XuiTitle lbTitle = new XuiTitle(VAGlobals.i18n("UI_Readme"),
34: XuiTitle.LEFT);
35: lbTitle.setFont(new Font("SansSerif", Font.PLAIN, 16));
36:
37: taLicense_ = new JTextArea();
38: taLicense_.setBackground(new Color(255, 255, 224));
39: taLicense_.setBorder(new EmptyBorder(5, 5, 5, 5));
40: taLicense_.setFont(new Font("Monospaced", Font.PLAIN, 12));
41: taLicense_.setEditable(false);
42: JScrollPane spLicense = new JScrollPane(taLicense_);
43: spLicense.setBorder(new LineBorder(Color.black, 2));
44: spLicense.getVerticalScrollBar().setBackground(Color.black);
45: spLicense.getHorizontalScrollBar().setBackground(Color.black);
46:
47: pnMain.add(BorderLayout.NORTH, lbTitle);
48: pnMain.add(BorderLayout.CENTER, spLicense);
49:
50: // JPanel pnImage=XuiImagePanel.IMAGE_PANEL;
51: // pnMain.setPreferredSize(new Dimension(200, pnImage.getPreferredSize().height));
52: // add(pnImage);
53: add(pnMain, BorderLayout.CENTER);
54: }
55:
56: public void setText(InputStream lic) {
57: String text = "";
58: if (lic == null) {
59: text += VAGlobals.i18n("UI_NoReadme");
60: } else {
61: try {
62: LineNumberReader in = new LineNumberReader(
63: new InputStreamReader(lic, "UTF-8"));
64: String line = in.readLine();
65: while (line != null) {
66: text += line + "\n";
67: line = in.readLine();
68: }
69: in.close();
70: } catch (IOException e) {
71: text += e.getMessage();
72: }
73: }
74: taLicense_.setText(text);
75: taLicense_.setCaretPosition(0);
76: }
77: }
|