Class Margin


  • public class Margin
    extends java.lang.Object

    The margin defines the space around elements.

    The class is based on the respective distances left, bottom, right, and top of type Length.

    • Constructor Detail

      • Margin

        public Margin​(double left,
                      double bottom,
                      double right,
                      double top,
                      Length.Units unit)
        Construct Margin object from values and a common unit.
        Parameters:
        left - as numerical value
        bottom - as numerical value
        right - as numerical value
        top - as numerical value
        unit - the unit
      • Margin

        public Margin​(Length margin)
        Construct a Margin object of equal margins
        Parameters:
        margin - as Length type
      • Margin

        public Margin​(double margin,
                      Length.Units unit)
        Construct a Margin object of equal margins
        Parameters:
        margin - as numerical value
        unit - the unit
    • Method Detail

      • parse

        public static Margin parse​(java.lang.String value)
        Create a Margin object from a string representation.
        Parameters:
        value - Allowed are value-unit pairs of the form "<left_value><left_unit> <bottom_value><bottom_unit> <right_value><right_unit> <top_value><top_unit>". Example: "12.3cm 23.4mm 34.5mm 45.6mm"
        Returns:
      • toString

        public java.lang.String toString()
        Creates a string representation as left-bottom-right-top-tuple with associated suitable metric units, "m", "cm" or "mm".
        Overrides:
        toString in class java.lang.Object
      • toString

        public java.lang.String toString​(Length.Units unit)
        Creates a string representation as left-bottom-right-top-tuple with the specified unit.
      • getLeft

        public Length getLeft()
        Gets the left margin as Length object.
      • getBottom

        public Length getBottom()
        Gets the bottom margin as Length object.
      • getRight

        public Length getRight()
        Gets the right margin as Length object.
      • getTop

        public Length getTop()
        Gets the top margin as Length object.
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object