Class Point2D.Float

  • All Implemented Interfaces:
    java.lang.Cloneable
    Direct Known Subclasses:
    Point
    Enclosing class:
    Point2D

    public static class Point2D.Float
    extends Point2D
    A point with float coordinates.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      float x
      The x coordinate of the point
      float y
      The y coordinate of the point
    • Constructor Summary

      Constructors 
      Constructor Description
      Float()
      Create a point at (0,0) with float coordinates
      Float​(float x, float y)
      Create a point at (x,y) with float coordinates
    • Field Detail

      • x

        public float x
        The x coordinate of the point
      • y

        public float y
        The y coordinate of the point
    • Constructor Detail

      • Float

        public Float()
        Create a point at (0,0) with float coordinates
      • Float

        public Float​(float x,
                     float y)
        Create a point at (x,y) with float coordinates
        Parameters:
        x - the x coordinate
        y - the y coordinate
    • Method Detail

      • getX

        public double getX()
        Description copied from class: Point2D
        Get the x coordinate as a double
        Specified by:
        getX in class Point2D
        Returns:
        the x co-ordinate (as a double)
      • getY

        public double getY()
        Description copied from class: Point2D
        Get the y coordinate as a double
        Specified by:
        getY in class Point2D
        Returns:
        the y coordinate (as a double)
      • setLocation

        public void setLocation​(double x,
                                double y)
        Description copied from class: Point2D
        Set the location of this Point2D using double coordinates
        Specified by:
        setLocation in class Point2D
        Parameters:
        x - the new x coordinate
        y - the new y coordinate
      • setLocation

        public void setLocation​(float x,
                                float y)
        Set the location of the point
        Parameters:
        x - the new x coordinate
        y - the new y coordinate
      • toString

        public java.lang.String toString()
        Represent the Point2SD.Float as a String
        Overrides:
        toString in class java.lang.Object