Class Location


  • public class Location
    extends java.lang.Object
    A point that does not use absolute coordinates, but is instead relative to the canvas borders. This is useful for user interface widgets, that tend to be positioned relative rather than absolute.
    • Method Detail

      • getX

        public float getX()
      • getY

        public float getY()
      • toPoint

        public Point2D toPoint()
      • relativeTo

        public Location relativeTo​(float deltaX,
                                   float deltaY)
        Creates a new location that is positioned at an offset relative to this location.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • fixed

        public static Location fixed​(float x,
                                     float y)
        Creates a location at fixed coordinates that will not move when the canvas is resized.
      • left

        public static Location left​(Canvas canvas,
                                    float x,
                                    float y)
      • right

        public static Location right​(Canvas canvas,
                                     float x,
                                     float y)
      • top

        public static Location top​(Canvas canvas,
                                   float x,
                                   float y)
      • bottom

        public static Location bottom​(Canvas canvas,
                                      float x,
                                      float y)
      • bottomCenter

        public static Location bottomCenter​(Canvas canvas,
                                            float y)
      • bottomRight

        public static Location bottomRight​(Canvas canvas,
                                           float x,
                                           float y)