Class CanvasGraph
Class CanvasGraph
Warning, links to the API class, i.e., java.awt.*, java.lang.*, etc.,
do not exist. Only links to Poggendoff class exists: the "see also" links.
java.lang.Object

+java.awt.Component

+java.awt.Canvas

+CanvasGraph
 class CanvasGraph
 extends Canvas
 implements DialogClient
This class draws the psychometric curve.

CanvasGraph(double[], int[], int)
 The constructor copies the parameters objects into class objects.

DrawCurve(Graphics)
 This method draws the graph

PtoC_X(double)
 This method converts graph model points (i.e., the graph defined in an abstract, righthanded
coordinate system) to points in the canvas coordinate system.

PtoC_Y(double)
 This method converts graph model points (i.e., the graph defined in an abstract, righthanded
coordinate system) to points in the canvas coordinate system.

dialogDismissed(Dialog)
 This interface method is called when an error dialog box is dismissed (the error being
that the results window is too small.

getOffset()
 This method returns the 50% offset value

paint(Graphics)
 When paint is called for the first time, we have access to the
bounds of the canvas at that time.
CanvasGraph
public CanvasGraph(double o[],
int p[],
int m)
 The constructor copies the parameters objects into class objects.
 Parameters:
 o  is an array of comparision line offsets
 p  is an array of ycomponent curve points
 m  is the maximum index value for the offset and percent arrays
dialogDismissed
public void dialogDismissed(Dialog d)
 This interface method is called when an error dialog box is dismissed (the error being
that the results window is too small. This implementation feature is part of the MessageDialog
class in the gjt package: it is called from the 'action' method of MessageDialog.class.
 Returns:
 void
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
 Parameters:
 g  is the Graphics objects attached to the current canvas
 Returns:
 void
 Overrides:
 paint in class Canvas
DrawCurve
public void DrawCurve(Graphics g)
 This method draws the graph
 Parameters:
 g  is the Graphics object attached to the class of this method
 Returns:
 void
getOffset
public double getOffset()
 This method returns the 50% offset value
 Parameters:
 Null  no parameters
 Returns:
 double the offset value
PtoC_X
public double PtoC_X(double p)
 This method converts graph model points (i.e., the graph defined in an abstract, righthanded
coordinate system) to points in the canvas coordinate system. In the graph model, the
xaxis values run from the largest negative value, which represents a comparison line below the
true connect point, to the largest positive value, which represents a comparison line above the
true connect point. To convert the graph model points into the canvas coordinate, I need the
largest negative offset to coorespond to where the graph origin will be in canvas coor. sys., i.e.,
xOffset% of way from the left hand side of the canvas (the xOffset*w factor). Each graph model x value
needs to be shifted to the right (i.e., it's value must be reduced by a factor "shiftX" which is
equal to the absolute value of the largest offset). This value must then be scaled into the range
of the xaxis (which is specificed in canvas coor. sys. values).
 Parameters:
 p  is a graph model xvalue
 Returns:
 double a cooresponding canvas coordinate system xvalue
PtoC_Y
public double PtoC_Y(double p)
 This method converts graph model points (i.e., the graph defined in an abstract, righthanded
coordinate system) to points in the canvas coordinate system. In the graph model, the
yaxis values run from 0, which represents zero "above" responses, to 100, which represents
100% "above" responses. To convert the graph model points into the canvas coordinate, I need the
0% to be ploted at the origin of the graph in the canvas cor. system (which is yOffset% of the canvas
height from the bottom of the canvasthis is the yOffset*h factor). All model percentage points must
then be scaled into the lenght of the yaxis, which is specified in canvas coor. sys. values, i.e.,
pixels (this is the "scaleY" factor). Finally, I need to take into account the lefthanded
nature of the canvas (i.e., y values increase as one goes DOWN the screen). For example, if the graph
model specifies a percentage of 100%, directly ploting that value will result in a point
towards the bottom of the canvas rather than towards the top where you would expect it. In order to
move that point up, I need to take 100 and add it to the height of the canvas. In short, model y
values where directly ploted, the graph would be upside down.
 Parameters:
 p  is a graph model xvalue
 Returns:
 double a cooresponding canvas coordinate system xvalue
Back to Results class documentation