Class Circle

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

public class Circle extends Object implements Drawable
A Drawable circle that uses awt drawing.
Version:
1.0
Author:
Wolfgang Christian
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
     
    int
     
    protected double
     
    protected double
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    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

    Modifier and Type
    Method
    Description
    void
    Draws the circle.
    Gets a loader that allows a Circle to be represented as XML data.
    double
    Gets the x coordinate.
    double
    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.
    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

      public Color 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

      public void draw(DrawingPanel panel, 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 String toString()
      Returns a string representation of the circle.
      Overrides:
      toString in class 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