Lab 4

Due 9:40AM September 29, 2008

  1. Implement a program that produces the following GUI:
gui

Your program will consist of a subclass of JPanel and a main Driver.  You will also create an inner class that implements the ActionListener for your JButton objects.

To set the initial color of the background of your JPanel to match the image above, use the setBackground method and pass it a Color object created using the RGB values 140, 24, 200.  If the user clicks the "Increase Red" button, increase the Red value by 5, to a limit of 255.  Do the same for green and blue.  If the user clicks the "Decrease Red" button, decrease the Red value by 5, down to 0.  Do the same for green and blue.
  1. Implement a program that provides a GUI that allows a user to open a text file and displays the contents of the file in a text area.  Your GUI will have, at minimum, a JTextArea and a JButton.  When the user presses the button, your program will use the JFileChooser to allow the user to select a file.  Your program will open the selected file and set the text of the text area to be the file's contents.


Sami Rollins