Enum Alignment

    • Method Detail

      • values

        public static Alignment[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (Alignment c : Alignment.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static Alignment valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null
      • getAlignment

        public static Alignment getAlignment​(Point point,
                                             Dimension size,
                                             Rectangle outerBounds,
                                             Alignment hint)
        Get fitting alignment.
        Parameters:
        point - point to align at.
        size - Size of rectangle to align.
        outerBounds - outer boundaries to align in.
        hint - preferred alignment.
        Returns:
        fitting alignment. If none is found the default is CENTER.
      • canBeAligned

        public boolean canBeAligned​(Point point,
                                    Dimension size,
                                    Rectangle outerBounds)
        Check whether the given Rectangle can be aligned at point inside boundaries.
        Parameters:
        point - point to align at.
        size - size of rectangle to align.
        outerBounds - boundaries.
        Returns:
        true if can be aligned.
      • relativePos

        public Point relativePos​(Dimension toAlign,
                                 Point alignAt)
        Get the relative Position of Rectangle to Point with respect to the alignment.
        Parameters:
        toAlign - size of Rectangle to align.
        alignAt - point to align at.
        Returns:
        top/left position of aligned rectangle
      • alignOutside

        public Point alignOutside​(Dimension toAlign,
                                  Rectangle innerBounds)
        Align Rectangle outside other rectangle with respect to the alignment.
        Parameters:
        toAlign - size of rectangle to align
        innerBounds - bounds of inside rectangle
        Returns:
        top/left point of aligned rectangle
      • getIndex

        public int getIndex()
        Get the index of the alignment. This function is for utility purposes where one might save settings based on alignment in an array.
        Returns:
        the index.
      • opposite

        public Alignment opposite()
        Get the opposite alignment.
        Returns:
        Alignment opposite on the compass.
      • anticlockwise

        public Alignment anticlockwise()
      • maskInsets

        public Insets maskInsets​(Insets insets,
                                 int maskValue)
      • maskInsets

        public Insets maskInsets​(int top,
                                 int left,
                                 int bottom,
                                 int right,
                                 int mask)
      • maskInsetsInverted

        public Insets maskInsetsInverted​(Insets insets)
      • maskInsetsInverted

        public Insets maskInsetsInverted​(Insets insets,
                                         int mask)
      • maskInsetsInverted

        public Insets maskInsetsInverted​(int top,
                                         int left,
                                         int bottom,
                                         int right,
                                         int mask)
      • alignInside

        public Point alignInside​(Dimension toAlign,
                                 Rectangle outerBounds)
        Align Rectangle inside other rectangle with respect to the alignment.
        Parameters:
        toAlign - size of rectangle to align
        outerBounds - bounds of outer rectangle
        Returns:
        top/left point of aligned rectangle
      • isNorth

        public boolean isNorth()
      • isSouth

        public boolean isSouth()
      • isEast

        public boolean isEast()
      • isWest

        public boolean isWest()
      • isEast

        public boolean isEast​(boolean includePure)
      • isWest

        public boolean isWest​(boolean includePure)
      • isVertical

        public boolean isVertical()
      • isHorizontal

        public boolean isHorizontal()
      • isDiagonal

        public boolean isDiagonal()
      • getAngle

        public double getAngle()
      • getDegreeAngle

        public int getDegreeAngle()