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

/** A window showing a file */
public class FileDisplay extends JFrame {

  /** This window's text area. */
  private JTextArea ta;

  /**
   * A new window showing the contents of file infile.
   * @param inFile the name of the file.
   * @throws IOException if there is a problem reading from inFile.
   */
  public FileDisplay(String inFile) throws IOException {
    Container c = this.getContentPane();
    ta = new JTextArea(40,80);
    c.add(ta,"Center");

    BufferedReader br = new BufferedReader(new FileReader(inFile));
    String line = br.readLine();
    while(line != null) {
      ta.append(line + "\n");
      line = br.readLine();
    }

    this.pack();
   }
}
