Class BreadthFirstApplet

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Panel
                    |
                    +--java.applet.Applet
                          |
                          +--BaseApplet
                                |
                                +--BreadthFirstApplet
All Implemented Interfaces:
javax.accessibility.Accessible, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.lang.Runnable, java.io.Serializable

public class BreadthFirstApplet
extends BaseApplet

Applet for demonstrating breadth-first search

See Also:
Serialized Form

Nested Class Summary
(package private)  class BreadthFirstApplet.DelayChoiceListener
          An inner class defining a listener for ItemEvents to the delay choice.
(package private)  class BreadthFirstApplet.SampleChoiceListener
          An inner class defining a listener for ItemEvents to the sample choice.
 
Field Summary
(package private)  java.awt.Choice delayChoice
           
(package private) static int[] delayOption
           
(package private)  AppletGrid grid
           
(package private)  int gridSize
           
(package private) static int initialSampleIndex
           
(package private)  java.awt.Font mainBold
           
(package private)  Sample[] sample
           
(package private)  java.awt.Choice sampleChoice
           
(package private) static java.lang.String stepsString
           
(package private)  int stepsTaken
           
(package private)  int xGridOffset
           
(package private)  int xString
           
(package private)  int yGridOffset
           
(package private)  int yString
           
 
Fields inherited from class BaseApplet
backgroundColor, currentDelay, foregroundColor, image, myThread, offScreen
 
Fields inherited from class java.applet.Applet
 
Fields inherited from class java.awt.Panel
 
Fields inherited from class java.awt.Container
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
BreadthFirstApplet()
           
 
Method Summary
(package private)  void drawEverything()
          Draw the results of one step.
(package private)  void drawGrid()
          Draw the grid and its contents.
(package private)  void drawSteps(int steps)
          Draw the String indicating number of steps.
 void init()
          Initialize the applet.
(package private)  void setDelays(java.awt.Choice delayChoice, int[] delayOption)
          Set the delay values in a choice menu.
(package private)  void setInput(int index)
          Set the input sample, create a new Grid, and initialize the search.
(package private)  void setSamples(java.awt.Choice sampleChoice, Sample[] sample)
          Set the sample titles in a choice menu.
 void step()
          Do a single step of the breadth-first search.
 
Methods inherited from class BaseApplet
clearOffScreenBuffer, continueRunning, createOffScreenBuffer, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, paint, paintBuffer, run, setDelay, sleep, sleep, start, update
 
Methods inherited from class java.applet.Applet
destroy, getAccessibleContext, getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus, stop
 
Methods inherited from class java.awt.Panel
addNotify
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, 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, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, 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

initialSampleIndex

static int initialSampleIndex

stepsString

static java.lang.String stepsString

mainBold

java.awt.Font mainBold

delayOption

static int[] delayOption

xGridOffset

int xGridOffset

yGridOffset

int yGridOffset

gridSize

int gridSize

xString

int xString

yString

int yString

sampleChoice

java.awt.Choice sampleChoice

delayChoice

java.awt.Choice delayChoice

sample

Sample[] sample

grid

AppletGrid grid

stepsTaken

int stepsTaken
Constructor Detail

BreadthFirstApplet

public BreadthFirstApplet()
Method Detail

init

public void init()
Initialize the applet.

Overrides:
init in class BaseApplet

setSamples

void setSamples(java.awt.Choice sampleChoice,
                Sample[] sample)
Set the sample titles in a choice menu.


setDelays

void setDelays(java.awt.Choice delayChoice,
               int[] delayOption)
Set the delay values in a choice menu.


setInput

void setInput(int index)
Set the input sample, create a new Grid, and initialize the search.


step

public void step()
Do a single step of the breadth-first search. This over-rides the corresponding method in BaseApplet.

Overrides:
step in class BaseApplet

drawEverything

void drawEverything()
Draw the results of one step.


drawGrid

void drawGrid()
Draw the grid and its contents.


drawSteps

void drawSteps(int steps)
Draw the String indicating number of steps.