Aquarium Lab Series

Partial Specification for Class AquaSimGUI

AquaSimGUI

public class AquaSimGUI

Aquarium Lab Series: The AquaSimGUI class provides a graphical user interface to the Aquarium Lab Series. This class uses the Java Power Tools (JPT) classes from Northeastern University to build the graphical interface. In particular, it inherits the repaint method (which does not appear in the specification for this class) from the JPT DisplayPanel class. The repaint method draws the components in the graphical user interface.

This partial specification for the AquaSimGUI class shows the public methods used by non-GUI client code, but does not show some of the public methods used just by the GUI.

Version:
10 July 2002

Constructor Summary
AquaSimGUI(Aquarium aquarium)
          Construct a simple graphical user interface for the Aquarium Simulation program.
AquaSimGUI(Aquarium aquarium, boolean promptForSimSteps)
          Construct a simple graphical user interface for the Aquarium Simulation program, with or without prompts for the number of simulation steps.
AquaSimGUI(Aquarium aquarium, boolean promptForSimSteps, boolean promptForNumFish)
          Construct a graphical user interface for the Aquarium Simulation program, with or without prompts for the number of simulation steps and the number of fish.
AquaSimGUI(Aquarium aquarium, boolean promptForSimSteps, boolean promptForNumFish, boolean useSimulationObj)
          Construct a graphical user interface for the Aquarium Simulation program, with or without prompts for the number of simulation steps and the number of fish.
 
Method Summary
 int getNumberOfFish()
          Get the number of fish to put in the aquarium from user input.
 int getNumberOfSteps()
          Get the number of steps to run from user input.
 void pauseToView()
          Pause so user can view the display.
 void show(AquaFish[] fishList)
          Display all the AquaFish in the fishList array.
 void show(java.util.ArrayList fishList)
          Display all the AquaFish in the fishList list.
 void showAquarium()
          Display only the Aquarium: paint the aquarium blue to cover up old fish.
 void showFish(AquaFish fish)
          Display a single AquaFish.
 void waitForStart()
          Wait for start button to be pushed.
 

Constructor Detail

AquaSimGUI

public AquaSimGUI(Aquarium aquarium)
Construct a simple graphical user interface for the Aquarium Simulation program.
Parameters:
aquarium - the aquarium in which the fish swim

AquaSimGUI

public AquaSimGUI(Aquarium aquarium,
                  boolean promptForSimSteps)
Construct a simple graphical user interface for the Aquarium Simulation program, with or without prompts for the number of simulation steps.
Parameters:
aquarium - the aquarium in which the fish swim
promptForSimSteps - true if GUI should prompt for number of simulation steps

AquaSimGUI

public AquaSimGUI(Aquarium aquarium,
                  boolean promptForSimSteps,
                  boolean promptForNumFish)
Construct a graphical user interface for the Aquarium Simulation program, with or without prompts for the number of simulation steps and the number of fish.
Parameters:
aquarium - the aquarium in which the fish swim
promptForSimSteps - true if GUI should prompt for number of simulation steps
promptForNumFish - true if GUI should prompt for number of fish

AquaSimGUI

public AquaSimGUI(Aquarium aquarium,
                  boolean promptForSimSteps,
                  boolean promptForNumFish,
                  boolean useSimulationObj)
Construct a graphical user interface for the Aquarium Simulation program, with or without prompts for the number of simulation steps and the number of fish.
Parameters:
aquarium - the aquarium in which the fish swim
promptForSimSteps - true if GUI should prompt for number of simulation steps
promptForNumFish - true if GUI should prompt for number of fish
useSimulationObj - true if GUI should construct and use a Simulation object
Method Detail

waitForStart

public void waitForStart()
Wait for start button to be pushed.

getNumberOfFish

public int getNumberOfFish()
Get the number of fish to put in the aquarium from user input.

getNumberOfSteps

public int getNumberOfSteps()
Get the number of steps to run from user input.

show

public void show(AquaFish[] fishList)
Display all the AquaFish in the fishList array. Paints the aquarium blue to cover up old fish and displays the fish in the array.
Parameters:
fishList - the array of AquaFish to be displayed

show

public void show(java.util.ArrayList fishList)
Display all the AquaFish in the fishList list. Paints the aquarium blue to cover up old fish and displays the fish in the list.
Parameters:
fishList - the list of AquaFish to be displayed

showAquarium

public void showAquarium()
Display only the Aquarium: paint the aquarium blue to cover up old fish. Not necessary when displaying an entire vector of fish.

showFish

public void showFish(AquaFish fish)
Display a single AquaFish.
Parameters:
fish - the fish to be displayed

pauseToView

public void pauseToView()
Pause so user can view the display.

Aquarium Lab Series

Copyright© 2002 Alyce Brady