CS 2121 Introduction to Java:
Programming Assignment 5

Due April 23, 30 points


For this lab you will write a program for viewing files. Unlike your previous programming assignments, which have been applets, this program is a stand-alone application. This is necessary because the program accesses files. This capability is denied to applets for security reasons.

There are two classes in the program, FileViewPane and FileViewer. The FileViewPane class encapsulates a JTextArea for displaying text, along with a JScrollPane to support scrolling through text that is too big to fit in the text area. It also provides methods for reading from a file into the text area and for saving the contents of the text area to a file. It is intended as a reusable class. The next programming assignment will make use of two FileViewPane objects.

The FileViewer class subclasses the JFrame class to provide a top-level window for the program. It is a showcase for many of the Swing features, including dialogs, menus, and toolbars.

The development of this program is broken up into the following steps.