Home » openjdk-7 » java » awt » [javadoc | source]
java.awt
public class: Point [javadoc | source]
java.lang.Object
   java.awt.geom.Point2D
      java.awt.Point

All Implemented Interfaces:
    Serializable, Cloneable

A point representing a location in {@code (x,y)} coordinate space, specified in integer precision.
Field Summary
public  int x    The X coordinate of this Point. If no X coordinate is set it will default to 0. 
public  int y    The Y coordinate of this Point. If no Y coordinate is set it will default to 0. 
Constructor:
 public Point() 
 public Point(Point p) 
    Constructs and initializes a point with the same location as the specified Point object.
    Parameters:
    p - a point
    since: 1.1 -
 public Point(int x,
    int y) 
Method from java.awt.Point Summary:
equals,   getLocation,   getX,   getY,   move,   setLocation,   setLocation,   setLocation,   toString,   translate
Methods from java.awt.geom.Point2D:
clone,   distance,   distance,   distance,   distanceSq,   distanceSq,   distanceSq,   equals,   getX,   getY,   hashCode,   setLocation,   setLocation
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from java.awt.Point Detail:
 public boolean equals(Object obj) 
    Determines whether or not two points are equal. Two instances of Point2D are equal if the values of their x and y member fields, representing their position in the coordinate space, are the same.
 public Point getLocation() 
    Returns the location of this point. This method is included for completeness, to parallel the getLocation method of Component.
 public double getX() 
    {@inheritDoc}
 public double getY() 
    {@inheritDoc}
 public  void move(int x,
    int y) 
    Moves this point to the specified location in the {@code (x,y)} coordinate plane. This method is identical with setLocation(int, int).
 public  void setLocation(Point p) 
    Sets the location of the point to the specified location. This method is included for completeness, to parallel the setLocation method of Component.
 public  void setLocation(int x,
    int y) 
    Changes the point to have the specified location.

    This method is included for completeness, to parallel the setLocation method of Component. Its behavior is identical with move(int, int).

 public  void setLocation(double x,
    double y) 
    Sets the location of this point to the specified double coordinates. The double values will be rounded to integer values. Any number smaller than Integer.MIN_VALUE will be reset to MIN_VALUE, and any number larger than Integer.MAX_VALUE will be reset to MAX_VALUE.
 public String toString() 
    Returns a string representation of this point and its location in the {@code (x,y)} coordinate space. This method is intended to be used only for debugging purposes, and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null.
 public  void translate(int dx,
    int dy) 
    Translates this point, at location {@code (x,y)}, by {@code dx} along the {@code x} axis and {@code dy} along the {@code y} axis so that it now represents the point {@code (x+dx,y+dy)}.