In this assignment you will modify the framework given to you in the previous assignment so that problems like the bridge crossing or water jug problems can be solved using a graphical user interface (GUI) rather than a terminal console.

Click Program Behavior to the left to observe how your program will look when complete.

Before you start, use NetBeans to copy your CS_2511_Framework project from the previous assignment to a new NetBeans project called CS_2511_GUI (right click the project node in the Projects window and select Copy...).

Note that you will not modify any existing classes in your bridge or waterjug packages.

You will implement the GUI class shown in the diagram below. Note that the rest of the diagram is the same as for the previous assignment.

Note how the GUI class plays a similar role in the framework as Console:
  • It is concrete (neither abstract nor an interface)
  • BridgeGUI and WaterJugGUI depend on it
BridgeGUI and WaterJugGUI are simple but complete classes given to you for testing.

ProblemPane and TestFrame are given to you to produce the tabbed pane shown in Program Behavior.

This section presents a skeletal GUI class to get you started.

When complete, this class will be able to present a GUI component for solving any problem that participates in the framework.

The code below shows the top-level form for the GUI class.

Download link:

Copy this class into your framework package.

The GUI class constructor needs to set an appropriate layout manager for the overall component, then create and add components for displaying:
  • The problem's introduction
  • The problem's current state
  • Buttons for the problem's available moves
    • Each button must be given an approproate action listener
  • A button to reset the problem to its starting configuration
Most of the work should be done by private helper methods.
This class creates a frame for solving the bridge crossing problem.

Download link:

Copy this class into your bridge package.

This class creates a frame containing tabbed panes for both problems.

Download link:

Create a subpackage of framework called test and copy this class there.

When your program is working correctly you will submit your entire Netbeans project, but first:
  • To double-check that everything is in order, click Build on the menu bar and select Clean and Build Main Project.
  • Run the bridge.BridgeGUI and waterjug.WaterJugGUI classes to make sure everything works.
  • Run the framework.test.TestFrame class to be doubly sure.
Outside of NetBeans, zip your project folder as

Email the zip file to your TA.

  • Correctness of layout and behavior: 24 points
  • Procedural abstraction (use of private helper methods): 6 points