package com.marinilli.b2.c7.launcher;

import java.awt.*;
import javax.swing.*;
import java.awt.event.*;

/**
 * Chapter 7 - shows the readme file
 *
 * @author Mauro Marinilli
 * @version 1.0
 */

public class ReadDialog extends InstallerDialog {
  private static final String TITLE = "Installation Notes - Read Carefully";
  JTextArea txt;
  JButton okButton = new JButton();

  /**
   *  Constructor
   */
  public ReadDialog(CDLauncher inst) {
    super(inst, TITLE);
    txt.setText(inst.getReadme());
    setSize(400,300);
    setVisible(true);
  }

  /**
   *  GUI initialization
   */
  void graphInit() {
    JPanel mainPanel = new JPanel(new BorderLayout());
    txt = new JTextArea();
    txt.setEditable(false);
    JScrollPane jScrollPane1 =
        new JScrollPane(txt,
                        JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
                        JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    JPanel southPanel = new JPanel(new BorderLayout());
    okButton = new JButton();
    okButton.setText("OK");
    okButton.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(ActionEvent e) {
        dispose();
      }
    });
    getContentPane().add(mainPanel, null);
    mainPanel.add(jScrollPane1, BorderLayout.CENTER);
    mainPanel.add(southPanel, BorderLayout.SOUTH);
    southPanel.add(okButton, BorderLayout.EAST);
  }

}