Class ControlPanel

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Panel
                           |
                           +----ControlPanel

public class ControlPanel
extends Panel
This class extends the java.awt.Panel class to form a panel which holds the buttons that control the animation of the algorithm.

In this particular application, it only consists of four image buttons, namely, run, stop, step, and skip.

See Also:
Panel

Constructor Index

 o ControlPanel(AlgAnimFrame, String)
Creates a panel to hold the control buttons of the animation tool.

Method Index

 o action(Event, Object)
Action handler for the buttons and choice buttons in the control panel.
 o getRunButton()
Returns an instance of the run ImageButton, which is casted to java.awt.Button
 o getSkipButton()
Returns an instance of the skip ImageButton, which is casted to java.awt.Button
 o getStepButton()
Returns an instance of the step ImageButton, which is casted to java.awt.Button
 o getStopButton()
Returns an instance of the stop ImageButton, which is casted to java.awt.Button
 o refreshButtons()
Perform a repaint() on each of the image buttons.

Constructors

 o ControlPanel
 public ControlPanel(AlgAnimFrame frame,
                     String algname)
Creates a panel to hold the control buttons of the animation tool.

Parameters:
frame - The parent window frame that contains this panel
algname - The algorithm name parsed from the applet parameter

Methods

 o refreshButtons
 public void refreshButtons()
Perform a repaint() on each of the image buttons.

 o action
 public boolean action(Event e,
                       Object arg)
Action handler for the buttons and choice buttons in the control panel.

Parameters:
e - Event invoked
arg - Object that invokes the event
Overrides:
action in class Component
 o getRunButton
 public Button getRunButton()
Returns an instance of the run ImageButton, which is casted to java.awt.Button

Returns:
Run button to initiate the animation of the algorithm.
 o getStopButton
 public Button getStopButton()
Returns an instance of the stop ImageButton, which is casted to java.awt.Button

Returns:
Stop button to terminate the execution of algorithm.
 o getStepButton
 public Button getStepButton()
Returns an instance of the step ImageButton, which is casted to java.awt.Button

Returns:
Step button to trace through the execution of the algorithm. If the Run button has already been pressed, the execution mode will be switched from RUN to STEP.
 o getSkipButton
 public Button getSkipButton()
Returns an instance of the skip ImageButton, which is casted to java.awt.Button

Returns:
Skip button to bypass the animation of the algorithm.