001: /**
002: * $RCSfile: XuiLicensePanel.java,v $
003: * @creation 01/02/00
004: * @modification $Date: 2001/06/12 06:41:39 $
005: */package com.memoire.vainstall.xui;
006:
007: import java.awt.*;
008: import java.io.*;
009: import java.awt.event.*;
010: import javax.swing.*;
011: import javax.swing.border.*;
012: import com.memoire.vainstall.VAGlobals;
013: import com.memoire.vainstall.VALicenseStep;
014:
015: /**
016: * @version $Id: XuiLicensePanel.java,v 1.5 2001/06/12 06:41:39 westbay Exp $
017: * @author Guillaume Desnoix
018: */
019:
020: public class XuiLicensePanel extends XuiAbstractPanel implements
021: VALicenseStep {
022: JTextArea taLicense_;
023: JRadioButton rdYes_, rdNo_;
024:
025: public XuiLicensePanel() {
026: super ();
027:
028: setLayout(new BorderLayout(5, 0));
029: setBorder(new EmptyBorder(5, 5, 5, 5));
030:
031: JPanel pnMain = new XuiPanel();
032: pnMain.setLayout(new BorderLayout());
033:
034: XuiTitle lbTitle = new XuiTitle(VAGlobals.i18n("UI_License"),
035: XuiTitle.LEFT);
036: lbTitle.setFont(new Font("SansSerif", Font.PLAIN, 16));
037:
038: taLicense_ = new JTextArea();
039: taLicense_.setBackground(new Color(255, 255, 224));
040: taLicense_.setBorder(new EmptyBorder(5, 5, 5, 5));
041: taLicense_.setFont(new Font("Monospaced", Font.PLAIN, 12));
042: taLicense_.setEditable(false);
043: JScrollPane spLicense = new JScrollPane(taLicense_);
044: spLicense.setBorder(new LineBorder(Color.black, 2));
045: spLicense.getVerticalScrollBar().setBackground(Color.black);
046: spLicense.getHorizontalScrollBar().setBackground(Color.black);
047:
048: JPanel pnChoice = new XuiPanel();
049: pnChoice.setOpaque(false);
050: pnChoice.setLayout(new BorderLayout(5, 5));
051: pnChoice.add(BorderLayout.WEST, new XuiLabel(VAGlobals
052: .i18n("UI_WantAcceptLicense")));
053: JPanel pnRadios = new XuiPanel();
054: pnRadios.setOpaque(false);
055: rdYes_ = new XuiRadioButton(VAGlobals.i18n("Common_Yes"));
056: rdYes_.setSelected(false);
057: rdNo_ = new XuiRadioButton(VAGlobals.i18n("Common_No"));
058: rdNo_.setSelected(true);
059: ButtonGroup bg = new ButtonGroup();
060: bg.add(rdYes_);
061: bg.add(rdNo_);
062: pnRadios.add(rdYes_);
063: pnRadios.add(rdNo_);
064: pnChoice.add(BorderLayout.CENTER, pnRadios);
065:
066: pnMain.add(BorderLayout.NORTH, lbTitle);
067: pnMain.add(BorderLayout.CENTER, spLicense);
068: pnMain.add(BorderLayout.SOUTH, pnChoice);
069:
070: // JPanel pnImage=XuiImagePanel.IMAGE_PANEL;
071: // pnMain.setPreferredSize(new Dimension(200, pnImage.getPreferredSize().height));
072: // add(pnImage);
073: add(pnMain, BorderLayout.CENTER);
074: }
075:
076: public void setText(InputStream lic) {
077: String text = "";
078: if (lic == null) {
079: text += VAGlobals.i18n("UI_NoLicense");
080: } else {
081: try {
082: LineNumberReader in = new LineNumberReader(
083: new InputStreamReader(lic, "UTF-8"));
084: String line = in.readLine();
085: while (line != null) {
086: text += line + "\n";
087: line = in.readLine();
088: }
089: in.close();
090: } catch (IOException e) {
091: text += e.getMessage();
092: }
093: }
094: taLicense_.setText(text);
095: taLicense_.setCaretPosition(0);
096: }
097:
098: public boolean isLicenseAccepted() {
099: return rdYes_.isSelected();
100: }
101: }
|