Class StimuliCanvas

Class StimuliCanvas

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Canvas
                   |
                   +----StimuliCanvas

class StimuliCanvas
extends Canvas
 The class instanciates objects that draw themselves (see StimulusObject class),
   sets up the experimental conditions (see TrialObject and ListofTrials classes), and
   finally launches a results window when the user has completed the demo.
See Also:
StimulusObject, TrialObject, ListOfTrials, Results

Constructor Index

 o StimuliCanvas(int, int, double, Muller11)
Constructor sets the totalNumberOfTrials--the private method that initializes the trial vector structure requires this info.

Method Index

 o collectResults()
This private utility method collects errors and n's from each trial object and saves then in the Results object.
 o lengthen()
Calls a method of the comparision line objects that either shortens or lengthens the comparision line depending on the parameter sent to the ".changeMe()" method.
 o nextTrial(HoldButton, HoldButton, HoldButton)
 o paint(Graphics)
When paint is called for the first time, we have access to the bounds of the canvas at that time.
 o setFlags(boolean, boolean)
Sets the flags that control the while loops in the synchronized shorten() and lengthen() routines.
 o shorten()
Calls a method of the comparision line objects that either shortens or lengthens the comparision line depending on the parameter sent to the ".changeMe()" method.

Constructors

 o StimuliCanvas
  public StimuliCanvas(int t,
                       int a,
                       double p,
                       Muller11 ap)
Constructor sets the totalNumberOfTrials--the private method that initializes the trial vector structure requires this info.
Parameters:
t - is the total number of experimental trials
a - is the angle btw. the main line segment and 1 segment of the arrow head
p - sets the length of the arrow head as a percentage of the main line segment length

Methods

 o paint
  public void paint(Graphics g)
When paint is called for the first time, we have access to the bounds of the canvas at that time. This is important because the features of the lines, at the beginning of each trial, require this info. The paint routine first checks to see if the experiment has started (i.e., the variable that keeps track of the number of trials is greater than 0)--if not, a trial initialization routine is called and based on the info. in the first trial object, features of the lines are initialized. It also calls the drawing methods of all graphics objects. . * @param g is a a Graphics objects attached to the current canvas
Returns:
nothing
Overrides:
paint in class Canvas
 o nextTrial
  public void nextTrial(HoldButton i,
                        HoldButton d,
                        HoldButton et)
 o collectResults
  public void collectResults()
This private utility method collects errors and n's from each trial object and saves then in the Results object. The Results object will then display them.
Returns:
void
 o setFlags
  public void setFlags(boolean i,
                       boolean d)
Sets the flags that control the while loops in the synchronized shorten() and lengthen() routines.
Parameters:
i - assigns true or false to the "increasing" class private data flag
d - assigns true or false to the "decreaseing" class private data flag
Returns:
nothing
 o shorten
  public synchronized void shorten()
Calls a method of the comparision line objects that either shortens or lengthens the comparision line depending on the parameter sent to the ".changeMe()" method. This threaded process will continue until either a MOUSE_UP event occurs (trapped by handleEvent()) or the line becomes too short. .
Returns:
nothing
 o lengthen
  public synchronized void lengthen()
Calls a method of the comparision line objects that either shortens or lengthens the comparision line depending on the parameter sent to the ".changeMe()" method. This threaded process will continue until either a MOUSE_UP event occurs (trapped by handleEvent()) or the line becomes too long. .
Returns:
nothing