Class GLine

GObject
   extended by GLine

The GLine class is a graphical object whose appearance consists of a line segment.


Constructor Summary
GLine(x0, y0, x1, y1)
Constructs a line segment from its endpoints.
 
Method Summary
getEndPoint()
Returns the end point of the line as a GPoint object.
getStartPoint()
Returns the coordinates of the initial point in the line.
setEndPoint(x, y)
Sets the end point of the line to the point (xy).
setStartPoint(x, y)
Sets the initial point in the line to (xy), leaving the end point unchanged.
 
Inherited Method Summary
contains(x, y)
Checks to see whether a point is inside the object.
getBounds()
Returns the bounding box for this object.
getColor()
Returns the color used to display this object.
isVisible()
Checks to see whether this object is visible.
scale(sf)
Scales the object on the screen by the scale factor sf, which applies in both dimensions.
sendBackward()
Moves this object one step toward the back in the z dimension.
sendForward()
Moves this object one step toward the front in the z dimension.
sendToBack()
Moves this object to the back of the display in the z dimension.
sendToFront()
Moves this object to the front of the display in the z dimension.
setColor(color)
Sets the color used to display this object.
setVisible(flag)
Sets whether this object is visible.
 

Constructor Detail

GLine(x0, y0, x1, y1)

Constructs a line segment from its endpoints. The point (x0y0) defines the start of the line and the point (x1y1) defines the end.
Usage: gline = GLine(x0, y0, x1, y1) 
Parameters: 
x0  The x-coordinate of the start of the line
y0  The y-coordinate of the start of the line
x1  The x-coordinate of the end of the line
y1  The y-coordinate of the end of the line
 

Method Detail

getEndPoint()

Returns the end point of the line as a GPoint object.
Usage: pt = gline.getEndPoint() 
Returns: The coordinates of the end point of the line
 


getStartPoint()

Returns the coordinates of the initial point in the line. This method is identical to getLocation and exists only to provide symmetry with setStartPoint.
Usage: pt = gline.getStartPoint() 
Returns: The coordinates of the origin of the line
 


setEndPoint(x, y)

Sets the end point of the line to the point (xy). The origin of the line remains unchanged.
Usage: gline.setEndPoint(x, y) 
Parameters: 
 The new x-coordinate of the end point
 The new y-coordinate of the end point
 


setStartPoint(x, y)

Sets the initial point in the line to (xy), leaving the end point unchanged. This method is therefore different from setLocation, which moves both components of the line segment.
Usage: gline.setStartPoint(x, y) 
Parameters: 
 The new x-coordinate of the origin
 The new y-coordinate of the origin