Opus5
Class GraphicalObject

java.lang.Object
  |
  +--Opus5.GraphicalObject
All Implemented Interfaces:
GraphicsPrimitives
Direct Known Subclasses:
Circle, Rectangle

public abstract class GraphicalObject
extends java.lang.Object
implements GraphicsPrimitives

The GraphicalObject class is the base class from which various concrete graphical object classes are derived.

Version:
$Id: GraphicalObject.java,v 3.2 1998/07/28 13:43:52 brpreiss Exp $
Author:
Bruno R. Preiss, P.Eng.

Field Summary
 int backgroundColor
          The background color.
protected  Point center
          The center point of this graphical object.
 int foregroundColor
          The foreground color.
 
Fields inherited from interface Opus5.GraphicsPrimitives
copyright
 
Constructor Summary
GraphicalObject(Point p)
          Constructs a GraphicalObject with the specified center point.
 
Method Summary
abstract  void draw()
          Draws this graphical object.
 void erase()
          Erases this graphical object.
 void moveTo(Point p)
          Moves this graphical object to the specified point.
 void setPenColor(int color)
          Sets the pen to the specified color.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

center

protected Point center
The center point of this graphical object.

backgroundColor

public final int backgroundColor
The background color.

foregroundColor

public final int foregroundColor
The foreground color.
Constructor Detail

GraphicalObject

public GraphicalObject(Point p)
Constructs a GraphicalObject with the specified center point.
Parameters:
p - The center point.
Method Detail

draw

public abstract void draw()
Draws this graphical object.
Specified by:
draw in interface GraphicsPrimitives

erase

public void erase()
Erases this graphical object. Implemented as follows:
 setPenColor (backgroundColor);
 draw ();
 setPenColor (foregroundColor);
 
Specified by:
erase in interface GraphicsPrimitives

moveTo

public void moveTo(Point p)
Moves this graphical object to the specified point. Implemented as follows:
 erase ();
 center = p;
 draw ();
 
Specified by:
moveTo in interface GraphicsPrimitives
Following copied from interface: Opus5.GraphicsPrimitives
Parameters:
p - The point to which this object is to be moved.
See Also:
Point

setPenColor

public void setPenColor(int color)
Sets the pen to the specified color. This method is not yet implemented.
Parameters:
color - The desired color of pen.
Throws:
MethodNotImplemented - Always.