Class AquaSimGUI

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by edu.neu.ccs.gui.DisplayPanel
                      extended by AquaSimGUI
All Implemented Interfaces:
edu.neu.ccs.gui.AlertListener, edu.neu.ccs.gui.Displayable, edu.neu.ccs.gui.MalformedDataListener, edu.neu.ccs.util.JPTConstants, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.SwingConstants

public class AquaSimGUI
extends edu.neu.ccs.gui.DisplayPanel

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.

Created:
10 July 2002, Alyce Brady

Modifications:
22 March 2008, Alyce Brady, Simplified by removing references to AquaPoint class and by folding many show methods into one that shows an aquarium and the fish it contains.

Version:
22 March 2008
Author:
Alyce Brady
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
(package private)  edu.neu.ccs.gui.Display controlPanelDisplay
           
 
Fields inherited from class edu.neu.ccs.gui.DisplayPanel
background, codec, CODEC
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface edu.neu.ccs.gui.Displayable
DEFAULT_VIEW_STATE, VIEW_STATE
 
Fields inherited from interface edu.neu.ccs.util.JPTConstants
ABOVE, ALIGNMENT, BELOW, DEFAULT, INPUT_PROPERTIES, MANDATORY, OPTIONAL, ORIENTATION
 
Fields inherited from interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
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.
 
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 print(java.lang.String s)
          Print the given string to the console-type output window.
 void println(java.lang.String s)
          Print the given string to the console-type output window, followed by a newline.
 void showAquarium()
          Display the aquarium and its contents: paint the aquarium blue to cover up old fish, then paint the fish in their current locations.
 void start()
          Start the simulation.
 void waitForStart()
          Wait for start button to be pushed.
 
Methods inherited from class edu.neu.ccs.gui.DisplayPanel
add, add, add, add, add, dataMalformed, endAlert, getCodec, getDefaultViewState, getViewState, remove, remove, removeAll, reset, setCodec, setDefaultViewState, setEnabled, setViewState, startAlert
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

controlPanelDisplay

edu.neu.ccs.gui.Display controlPanelDisplay
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
Method Detail

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.


print

public void print(java.lang.String s)
Print the given string to the console-type output window.


println

public void println(java.lang.String s)
Print the given string to the console-type output window, followed by a newline.


showAquarium

public void showAquarium()
Display the aquarium and its contents: paint the aquarium blue to cover up old fish, then paint the fish in their current locations.


start

public void start()
Start the simulation. (Activated by the start button.)


waitForStart

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