Package org.opensourcephysics.display
Class Circle
java.lang.Object
org.opensourcephysics.display.Circle
- All Implemented Interfaces:
Drawable
- Direct Known Subclasses:
MeasuredCircle
,TrackableCircle
A Drawable circle that uses awt drawing.
- Version:
- 1.0
- Author:
- Wolfgang Christian
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
draw
(DrawingPanel panel, Graphics g) Draws the circle.static XML.ObjectLoader
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.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
Methods inherited from interface org.opensourcephysics.display.Drawable
isInteractive
-
Field Details
-
color
-
pixRadius
public int pixRadius -
x
protected double x -
y
protected double y
-
-
Constructor Details
-
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 Details
-
draw
Draws the circle. -
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
Returns a string representation of the circle. -
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
-