Package resources

Class Settings.Region2D

  • All Implemented Interfaces:
    java.awt.Shape, java.io.Serializable, java.lang.Cloneable
    Enclosing class:
    Settings

    public static class Settings.Region2D
    extends java.awt.geom.Rectangle2D.Double
    A specialized Rectangle2D that is more easily converted to or from a setting value.
    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class java.awt.geom.Rectangle2D

        java.awt.geom.Rectangle2D.Double, java.awt.geom.Rectangle2D.Float
    • Field Summary

      • Fields inherited from class java.awt.geom.Rectangle2D.Double

        height, width, x, y
      • Fields inherited from class java.awt.geom.Rectangle2D

        OUT_BOTTOM, OUT_LEFT, OUT_RIGHT, OUT_TOP
    • Constructor Summary

      Constructors 
      Constructor Description
      Region2D()
      Creates a new region at (0,0) with zero width and height.
      Region2D​(double x, double y, double w, double h)
      Creates a new region with the specified coordinates and dimensions.
      Region2D​(java.awt.geom.Rectangle2D.Double r)
      Creates a new region from the specified rectangle.
      Region2D​(java.lang.String settingValue)
      Creates a new region from a string using the same format as a region setting value.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      double getX2()
      Returns the x-coordinate of the right edge of the region.
      double getY2()
      Returns the y-coordinate of the bottom edge of the region.
      Settings.Region2D inset​(double dx, double dy)
      Returns a new region that is inset by the specified amount.
      void setX2​(double x2)
      Moves the right edge of the region to the specified x-coordinate by changing the width of the region.
      void setY2​(double y2)
      Moves the bottom edge of the region to the specified y-coordinate by changing the height of the region.
      Settings.Region toRegion()
      Returns an integer precision region by rounding this region's coordinates and dimensions.
      java.lang.String toString()
      Returns a string value suitable for storing this region in a setting.
      • Methods inherited from class java.awt.geom.Rectangle2D.Double

        createIntersection, createUnion, getBounds2D, getHeight, getWidth, getX, getY, isEmpty, outcode, setRect, setRect
      • Methods inherited from class java.awt.geom.Rectangle2D

        add, add, add, contains, contains, equals, getPathIterator, getPathIterator, hashCode, intersect, intersects, intersectsLine, intersectsLine, outcode, setFrame, union
      • Methods inherited from class java.awt.geom.RectangularShape

        clone, contains, contains, getBounds, getCenterX, getCenterY, getFrame, getMaxX, getMaxY, getMinX, getMinY, intersects, setFrame, setFrame, setFrameFromCenter, setFrameFromCenter, setFrameFromDiagonal, setFrameFromDiagonal
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Region2D

        public Region2D​(java.lang.String settingValue)
        Creates a new region from a string using the same format as a region setting value.
        Parameters:
        settingValue - the setting value to create a region from
      • Region2D

        public Region2D​(java.awt.geom.Rectangle2D.Double r)
        Creates a new region from the specified rectangle.
        Parameters:
        r - the rectangle to convert
      • Region2D

        public Region2D​(double x,
                        double y,
                        double w,
                        double h)
        Creates a new region with the specified coordinates and dimensions.
        Parameters:
        x - the x-coordinate
        y - the y-coordinate
        w - the region width
        h - the region height
      • Region2D

        public Region2D()
        Creates a new region at (0,0) with zero width and height.
    • Method Detail

      • toRegion

        public Settings.Region toRegion()
        Returns an integer precision region by rounding this region's coordinates and dimensions.
        Returns:
        an integer precision region
      • inset

        public Settings.Region2D inset​(double dx,
                                       double dy)
        Returns a new region that is inset by the specified amount. For example, if the region is (0,0,10,10) and you call inset(2,2), the result will be (2,2,6,6). Passing a negative value will cause the region to grow. If the region is too small to be inset by the specified amount, the result will have a width or height of zero.
        Parameters:
        dx - the amount to move the left and right edges inward
        dy - the amount to move the top and bottom edges inward
        Returns:
        a new region that is inset by the specified amount
      • setX2

        public void setX2​(double x2)
        Moves the right edge of the region to the specified x-coordinate by changing the width of the region.
        Parameters:
        x2 - the new x-coordinate for the right edge
      • getX2

        public double getX2()
        Returns the x-coordinate of the right edge of the region. Equivalent to getMaxX, but provides consistency with Region.
        Returns:
        the x-coordinate of the right edge
      • setY2

        public void setY2​(double y2)
        Moves the bottom edge of the region to the specified y-coordinate by changing the height of the region.
        Parameters:
        y2 - the new y-coordinate for the bottom edge
      • getY2

        public double getY2()
        Returns the y-coordinate of the bottom edge of the region. Equivalent to getMaxY, but provides consistency with Region.
        Returns:
        the y-coordinate of the bottom edge
      • toString

        public java.lang.String toString()
        Returns a string value suitable for storing this region in a setting.
        Overrides:
        toString in class java.awt.geom.Rectangle2D.Double
        Returns:
        a regions string with form x,y,width,height