Package doodlepad
Class Point
java.lang.Object
doodlepad.Point
A simple utility Point class.
-
Constructor Summary
ConstructorDescriptionPoint
(double x, double y) Point object constructor from coordinatesPoint object constructor from an AWT Point2D objectPoint object constructor from an AWT Point object -
Method Summary
Modifier and TypeMethodDescriptiondouble
getX()
Gets the Point object's current x-coordinate.double
getY()
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
setLocation
(Point p) 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.toString()
Generate a representation of the Point object.
-
Constructor Details
-
Point
public Point(double x, double y) Point object constructor from coordinates- Parameters:
x
- x-coordinate or Pointy
- y-coordinate of Point
-
Point
Point object constructor from an AWT Point object- Parameters:
p
- An AWT Point object
-
Point
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
Update the coordinates stored by the Point object from an AWT Point object.- Parameters:
p
- An AWT Point object
-
setLocation
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
Generate a representation of the Point object.
-