Package doodlepad

Class Point

java.lang.Object
doodlepad.Point

public class Point extends Object
A simple utility Point class.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Point(double x, double y)
    Point object constructor from coordinates
    Point object constructor from an AWT Point2D object
    Point object constructor from an AWT Point object
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    Gets the Point object's current x-coordinate.
    double
    Gets the Point object's current y-coordinate.
    void
    setLocation(double x, double y)
    Update the coordinates stored by the Point object from coordinates.
    void
    Update the coordinates stored by the Point object from an AWT Point2D object.
    void
    Update the coordinates stored by the Point object from an AWT Point object.
    void
    setX(double x)
    Sets the Point object's current x-coordinate.
    void
    setY(double y)
    Sets the Point object's current y-coordinate.
    Generate a representation of the Point object.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Point

      public Point(double x, double y)
      Point object constructor from coordinates
      Parameters:
      x - x-coordinate or Point
      y - y-coordinate of Point
    • Point

      public Point(Point p)
      Point object constructor from an AWT Point object
      Parameters:
      p - An AWT Point object
    • Point

      public Point(Point2D.Double p)
      Point object constructor from an AWT Point2D object
      Parameters:
      p - An AWT Point@D object
  • Method Details

    • setLocation

      public void setLocation(double x, double y)
      Update the coordinates stored by the Point object from coordinates.
      Parameters:
      x - The new Point object x-coordinate value.
      y - The new Point object y-coordinate value.
    • setLocation

      public void setLocation(Point p)
      Update the coordinates stored by the Point object from an AWT Point object.
      Parameters:
      p - An AWT Point object
    • setLocation

      public void setLocation(Point2D.Double p)
      Update the coordinates stored by the Point object from an AWT Point2D object.
      Parameters:
      p - An AWT Point2D object
    • getX

      public double getX()
      Gets the Point object's current x-coordinate.
      Returns:
      x-coordinate value.
    • setX

      public void setX(double x)
      Sets the Point object's current x-coordinate.
      Parameters:
      x - The new x-coordinate value.
    • getY

      public double getY()
      Gets the Point object's current y-coordinate.
      Returns:
      y-coordinate value.
    • setY

      public void setY(double y)
      Sets the Point object's current y-coordinate.
      Parameters:
      y - The new y-coordinate value.
    • toString

      public String toString()
      Generate a representation of the Point object.
      Overrides:
      toString in class Object
      Returns:
      String representation