CS 3744, Assignment 5 -
Due March 18, 2010
Instructions
Use the initial version of the VTGUI framework that demonstrates the use of a GUI
label. The application code is provided (see
HomeworkFive.java) and the
main window is an instance of the HomeworkFive class that extends the VTFrame
class and has the title "Homework Five". Your task is to extend the code for the
framework, as described in the lecture slide set 14. Within the cs3744.gui
package, create an event package for event-related classes. Follow the JavaBeans
conventions.
- Create a button GUI component, VTButton, that generates a VTActionEvent when
the button was clicked (no interaction with the keyboard required).
- Provide the corresponding VTActionListener interface with the single method
actionPerformed (VTActionEvent e).
- Provide the corresponding VTActionAdapter class.
- Provide support for dynamic layout changes (add/remove component, change
layout) and component changes (background/foreground colors, text, alignment).
The HomeworkFive class uses the VTButton class that provides button
functionality. One instance of VTButton and one or more instances of VTLabel
class are placed in VTPanel. The layout is provided through the VTGridLayout
class. Look at the Java Swing API documentation for the similar classes and
determine the minimum set of methods that support the required functionality.
Use those methods to define an API for each of the classes.
Homework Five example (see hw5.png)
- Initially, the layout is similar to the one in Homework Four.
- First click removes the second label and changes the layout.
- Second click adds the second label and changes the layout.
- Subsequent clicks alternate between 2. and 3.
A sample implementation of classes event package (except for those required for
the submission) is provided (see hw5event.jar).
Instructions
- The submission deadline is by 11:55pm on the date above.
- Submit a single .jar archive. The name is based on your VT pid, i.e <pid>HW5.jar.
- The .jar archive includes all the .java files (in the
corresponding folders) in the cs3744.gui package and the cs3744.gui.event package.
- You must use javadoc comments to document your code (all public
components).
Additional Resources