org.opensourcephysics.display
Class Circle

java.lang.Object
  extended by org.opensourcephysics.display.Circle
All Implemented Interfaces:
Drawable
Direct Known Subclasses:
MeasuredCircle, TrackableCircle

public class Circle
extends java.lang.Object
implements Drawable

A Drawable circle that uses awt drawing.

Version:
1.0
Author:
Wolfgang Christian

Field Summary
 java.awt.Color color
           
 int pixRadius
           
protected  double x
           
protected  double y
           
 
Constructor Summary
Circle()
          Constructs a fixed radius circle at the origin.
Circle(double _x, double _y)
          Constructs a fixed radius circle at the given coordinates.
Circle(double _x, double _y, int _r)
          Constructs a fixed radius circle at the given coordinates with the given radius.
 
Method Summary
 void draw(DrawingPanel panel, java.awt.Graphics g)
          Draws the circle.
static XML.ObjectLoader getLoader()
          Gets a loader that allows a Circle to be represented as XML data.
 double getX()
          Gets the x coordinate.
 double getY()
          Gets the y coordinate.
 void setX(double x)
          Sets the x coordinate.
 void setXY(double x, double y)
          Sets the x and y coordinates.
 void setY(double y)
          Sets the y coordinate.
 java.lang.String toString()
          Returns a string representation of the circle.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

color

public java.awt.Color color

pixRadius

public int pixRadius

x

protected double x

y

protected double y
Constructor Detail

Circle

public Circle()
Constructs a fixed radius circle at the origin.


Circle

public Circle(double _x,
              double _y)
Constructs a fixed radius circle at the given coordinates. The default radius is 6 pixels.

Parameters:
_x -
_y -

Circle

public Circle(double _x,
              double _y,
              int _r)
Constructs a fixed radius circle at the given coordinates with the given radius. The radius is given in pixels.

Parameters:
_x -
_y -
_r -
Method Detail

draw

public void draw(DrawingPanel panel,
                 java.awt.Graphics g)
Draws the circle.

Specified by:
draw in interface Drawable
Parameters:
panel -
g -

getX

public double getX()
Gets the x coordinate.

Returns:
double x

setX

public void setX(double x)
Sets the x coordinate.

Parameters:
x -

getY

public double getY()
Gets the y coordinate.

Returns:
double y

setY

public void setY(double y)
Sets the y coordinate.

Parameters:
y -

setXY

public void setXY(double x,
                  double y)
Sets the x and y coordinates.

Parameters:
x -
y -

toString

public java.lang.String toString()
Returns a string representation of the circle.

Overrides:
toString in class java.lang.Object
Returns:
String

getLoader

public static XML.ObjectLoader getLoader()
Gets a loader that allows a Circle to be represented as XML data. Objects without XML loaders cannot be saved and retrieved from an XML file.

Returns:
ObjectLoader