Overview
Package
Class
Use
Tree
Deprecated
Index
All Classes
Help
Prev Class
Next Class
Sample
Document
Class java.awt.Point
Inherited members: ShowHide
Deprecated: ShowHide
View: ClientSubclassPackageImplementation
java.awt

Class Point

  • java.lang.Object
    • java.awt.geom.Point2D
      • java.awt.Point
  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable
    public class Point extends java.awt.geom.Point2D implements java.io.Serializable
    A point representing a location in (x,y) coordinate space, specified in integer precision.
    Since:
    1.0
    See Also:
    Serialized Form
    • Nested Classes 
      Modifier and Type Class and Description
      Inherited member indicator awt.geom.Point2D.Double Reveal DetailHide Detail
      static class awt.geom.Point2D.Double
      The Double class defines a point specified in double precision.
      static class awt.geom.Point2D.Double
      The Double class defines a point specified in double precision.
      Since:
      1.2
      See Also:
      Serialized Form
      Inherited member indicator awt.geom.Point2D.Float Reveal DetailHide Detail
      static class awt.geom.Point2D.Float
      The Float class defines a point specified in float precision.
      static class awt.geom.Point2D.Float
      The Float class defines a point specified in float precision.
      Since:
      1.2
      See Also:
      Serialized Form
    • Fields 
      Modifier and Type Field and Description
      Ordinary member indicator x Reveal DetailHide Detail
      int x
      The X coordinate of this Point.
      public int x
      The X coordinate of this Point. If no X coordinate is set it will default to 0.
      Since:
      1.0
      See Also:
      getLocation(), move(int, int)
      Ordinary member indicator y Reveal DetailHide Detail
      int y
      The Y coordinate of this Point.
      public int y
      The Y coordinate of this Point. If no Y coordinate is set it will default to 0.
      Since:
      1.0
      See Also:
      getLocation(), move(int, int)
    • Static Methods 
      Modifier and Type Static Method and Description
      Inherited member indicator distance Reveal DetailHide Detail
      static double distance(double x1, double y1, double x2, double y2)
      Returns the distance between two points.
      public static double distance(double x1, double y1, double x2, double y2)
      Description copied from class: java.awt.geom.Point2D
      Returns the distance between two points.
      Parameters:
      x1 - the X coordinate of the first specified point
      y1 - the Y coordinate of the first specified point
      x2 - the X coordinate of the second specified point
      y2 - the Y coordinate of the second specified point
      Returns:
      the distance between the two sets of specified coordinates.
      Since:
      1.2
      Inherited member indicator distanceSq Reveal DetailHide Detail
      static double distanceSq(double x1, double y1, double x2, double y2)
      Returns the square of the distance between two points.
      public static double distanceSq(double x1, double y1, double x2, double y2)
      Description copied from class: java.awt.geom.Point2D
      Returns the square of the distance between two points.
      Parameters:
      x1 - the X coordinate of the first specified point
      y1 - the Y coordinate of the first specified point
      x2 - the X coordinate of the second specified point
      y2 - the Y coordinate of the second specified point
      Returns:
      the square of the distance between the two sets of specified coordinates.
      Since:
      1.2
    • Constructors 
      Constructor and Description
      Ordinary member indicator Point Reveal DetailHide Detail
      Point()
      Constructs and initializes a point at the origin (0, 0) of the coordinate space.
      public Point()
      Constructs and initializes a point at the origin (0, 0) of the coordinate space.
      Since:
      1.1
      Ordinary member indicator Point Reveal DetailHide Detail
      Point(int x, int y)
      Constructs and initializes a point at the specified (x,y) location in the coordinate space.
      public Point(int x, int y)
      Constructs and initializes a point at the specified (x,y) location in the coordinate space.
      Parameters:
      x - the X coordinate of the newly constructed Point
      y - the Y coordinate of the newly constructed Point
      Since:
      1.0
      Ordinary member indicator Point Reveal DetailHide Detail
      Point(Point p)
      Constructs and initializes a point with the same location as the specified Point object.
      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
    • Methods 
      Modifier and Type Method and Description
      Inherited member indicator clone Reveal DetailHide Detail
      java.lang.Object clone()
      Creates a new object of the same class and with the same contents as this object.
      public java.lang.Object clone()
      Description copied from class: java.awt.geom.Point2D
      Creates a new object of the same class and with the same contents as this object.
      Overrides:
      clone in class java.lang.Object
      Returns:
      a clone of this instance.
      Throws:
      java.lang.OutOfMemoryError - if there is not enough memory.
      Since:
      1.2
      See Also:
      Cloneable
      Inherited member indicator distance Reveal DetailHide Detail
      double distance(double px, double py)
      Returns the distance from this Point2D to a specified point.
      public double distance(double px, double py)
      Description copied from class: java.awt.geom.Point2D
      Returns the distance from this Point2D to a specified point.
      Parameters:
      px - the X coordinate of the specified point to be measured against this Point2D
      py - the Y coordinate of the specified point to be measured against this Point2D
      Returns:
      the distance between this Point2D and a specified point.
      Since:
      1.2
      Inherited member indicator distance Reveal DetailHide Detail
      double distance(java.awt.geom.Point2D pt)
      Returns the distance from this Point2D to a specified Point2D.
      public double distance(java.awt.geom.Point2D pt)
      Description copied from class: java.awt.geom.Point2D
      Returns the distance from this Point2D to a specified Point2D.
      Parameters:
      pt - the specified point to be measured against this Point2D
      Returns:
      the distance between this Point2D and the specified Point2D.
      Since:
      1.2
      Inherited member indicator distanceSq Reveal DetailHide Detail
      double distanceSq(double px, double py)
      Returns the square of the distance from this Point2D to a specified point.
      public double distanceSq(double px, double py)
      Description copied from class: java.awt.geom.Point2D
      Returns the square of the distance from this Point2D to a specified point.
      Parameters:
      px - the X coordinate of the specified point to be measured against this Point2D
      py - the Y coordinate of the specified point to be measured against this Point2D
      Returns:
      the square of the distance between this Point2D and the specified point.
      Since:
      1.2
      Inherited member indicator distanceSq Reveal DetailHide Detail
      double distanceSq(java.awt.geom.Point2D pt)
      Returns the square of the distance from this Point2D to a specified Point2D.
      public double distanceSq(java.awt.geom.Point2D pt)
      Description copied from class: java.awt.geom.Point2D
      Returns the square of the distance from this Point2D to a specified Point2D.
      Parameters:
      pt - the specified point to be measured against this Point2D
      Returns:
      the square of the distance between this Point2D to a specified Point2D.
      Since:
      1.2
      Overridden member indicator equals Reveal DetailHide Detail
      boolean equals(java.lang.Object obj)
      Determines whether or not two points are equal.
      public boolean equals(java.lang.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.
      Overrides:
      equals in class java.awt.geom.Point2D
      Parameters:
      obj - an object to be compared with this Point2D
      Returns:
      true if the object to be compared is an instance of Point2D and has the same values; false otherwise.
      See Also:
      Object.hashCode(), HashMap
      Ordinary member indicator getLocation Reveal DetailHide Detail
      Point getLocation()
      Returns the location of this point.
      public Point getLocation()
      Returns the location of this point. This method is included for completeness, to parallel the getLocation method of Component.
      Returns:
      a copy of this point, at the same location
      Since:
      1.1
      See Also:
      Component.getLocation(), setLocation(java.awt.Point), setLocation(int, int)
      Overridden member indicator getX Reveal DetailHide Detail
      double getX()
      Returns the X coordinate of this Point2D in double precision.
      public double getX()
      Returns the X coordinate of this Point2D in double precision.
      Specified by:
      getX in class java.awt.geom.Point2D
      Returns:
      the X coordinate of this Point2D.
      Since:
      1.2
      Overridden member indicator getY Reveal DetailHide Detail
      double getY()
      Returns the Y coordinate of this Point2D in double precision.
      public double getY()
      Returns the Y coordinate of this Point2D in double precision.
      Specified by:
      getY in class java.awt.geom.Point2D
      Returns:
      the Y coordinate of this Point2D.
      Since:
      1.2
      Inherited member indicator hashCode Reveal DetailHide Detail
      int hashCode()
      Returns the hashcode for this Point2D.
      public int hashCode()
      Description copied from class: java.awt.geom.Point2D
      Returns the hashcode for this Point2D.
      Overrides:
      hashCode in class java.lang.Object
      Returns:
      a hash code for this Point2D.
      See Also:
      Object.equals(java.lang.Object), System.identityHashCode(java.lang.Object)
      Ordinary member indicator move Reveal DetailHide Detail
      void move(int x, int y)
      Moves this point to the specified location in the (x,y) coordinate plane.
      public void move(int x, int y)
      Moves this point to the specified location in the (x,y) coordinate plane. This method is identical with setLocation(int, int).
      Parameters:
      x - the X coordinate of the new location
      y - the Y coordinate of the new location
      See Also:
      Component.setLocation(int, int)
      Overridden member indicator setLocation Reveal DetailHide Detail
      void setLocation(double x, double y)
      Sets the location of this point to the specified double coordinates.
      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.
      Specified by:
      setLocation in class java.awt.geom.Point2D
      Parameters:
      x - the X coordinate of the new location
      y - the Y coordinate of the new location
      See Also:
      getLocation()
      Ordinary member indicator setLocation Reveal DetailHide Detail
      void setLocation(int x, int y)
      Changes the point to have the specified location.
      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).

      Parameters:
      x - the X coordinate of the new location
      y - the Y coordinate of the new location
      Since:
      1.1
      See Also:
      Component.setLocation(int, int), getLocation(), move(int, int)
      Ordinary member indicator setLocation Reveal DetailHide Detail
      void setLocation(Point p)
      Sets the location of the point to the specified location.
      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.
      Parameters:
      p - a point, the new location for this point
      Since:
      1.1
      See Also:
      Component.setLocation(java.awt.Point), getLocation()
      Inherited member indicator setLocation Reveal DetailHide Detail
      void setLocation(java.awt.geom.Point2D p)
      Sets the location of this Point2D to the same coordinates as the specified Point2D object.
      public void setLocation(java.awt.geom.Point2D p)
      Description copied from class: java.awt.geom.Point2D
      Sets the location of this Point2D to the same coordinates as the specified Point2D object.
      Parameters:
      p - the specified Point2D to which to set this Point2D
      Since:
      1.2
      Overridden member indicator toString Reveal DetailHide Detail
      java.lang.String toString()
      Returns a string representation of this point and its location in the (x,y) coordinate space.
      public java.lang.String toString()
      Returns a string representation of this point and its location in the (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.
      Overrides:
      toString in class java.lang.Object
      Returns:
      a string representation of this point
      Ordinary member indicator translate Reveal DetailHide Detail
      void translate(int dx, int dy)
      Translates this point, at location (x,y), by dx along the x axis and dy along the y axis so that it now represents the point (x+dx,y+dy).
      public void translate(int dx, int dy)
      Translates this point, at location (x,y), by dx along the x axis and dy along the y axis so that it now represents the point (x+dx,y+dy).
      Parameters:
      dx - the distance to move this point along the X axis
      dy - the distance to move this point along the Y axis
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
This document was created by Dulcet from the OpenJDK sources. Copyright © 1993, 2012 Oracle and/or its affiliates. All rights reserved.

SourceForge