01: /**
02: * $RCSfile: VAReadmePanel.java,v $
03: * @creation 01/02/00
04: * @modification $Date: 2001/06/12 06:41:39 $
05: */package com.memoire.vainstall.gui;
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: VAReadmePanel.java,v 1.4 2001/06/12 06:41:39 westbay Exp $
17: * @author Axel von Arnim
18: */
19:
20: public class VAReadmePanel extends VAPanel implements VAReadmeStep {
21: JTextArea taLicense_;
22:
23: public VAReadmePanel() {
24: super ();
25:
26: setLayout(new BoxLayout(this , BoxLayout.X_AXIS));
27:
28: JPanel pnMain = new JPanel();
29: pnMain.setBorder(new CompoundBorder(new EtchedBorder(),
30: new EmptyBorder(new Insets(5, 5, 5, 5))));
31: pnMain.setLayout(new BorderLayout());
32: JLabel lbTitle = new JLabel(VAGlobals.i18n("UI_Readme"));
33: lbTitle.setFont(lbTitle.getFont().deriveFont(Font.BOLD, 20));
34: lbTitle.setOpaque(true);
35: lbTitle.setBorder(new EmptyBorder(new Insets(5, 0, 5, 0)));
36: lbTitle.setBackground(pnMain.getBackground().darker());
37: lbTitle.setForeground(Color.white);
38:
39: taLicense_ = new JTextArea();
40: taLicense_.setEditable(false);
41: taLicense_.setFont(new Font("Monospaced", Font.PLAIN, 10));
42: JScrollPane spLicense = new JScrollPane(taLicense_);
43:
44: pnMain.add(BorderLayout.NORTH, lbTitle);
45: pnMain.add(BorderLayout.CENTER, spLicense);
46:
47: JComponent pnImage = VAImagePanel.IMAGE_PANEL;
48: add(pnImage);
49: add(pnMain);
50: }
51:
52: public void setText(InputStream lic) {
53: String text = "";
54: if (lic == null) {
55: text += VAGlobals.i18n("UI_NoReadme");
56: } else {
57: try {
58: LineNumberReader in = new LineNumberReader(
59: new InputStreamReader(lic, "UTF-8"));
60: String line = in.readLine();
61: while (line != null) {
62: text += line + "\n";
63: line = in.readLine();
64: }
65: in.close();
66: } catch (IOException e) {
67: text += e.getMessage();
68: }
69: }
70: taLicense_.setText(text);
71: taLicense_.setCaretPosition(0);
72: }
73: }
|