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 | Description |
---|---|
Margin(double left,
double bottom,
double right,
double top,
Length.Units unit) |
Construct
Margin object from values and a common unit. |
Margin(double margin,
Length.Units unit) |
Construct a
Margin object of equal margins |
Margin(Length margin) |
Construct a
Margin object of equal margins |
Margin(Length left,
Length bottom,
Length right,
Length top) |
Construct
Margin object from individual values |
Modifier and Type | Method | Description |
---|---|---|
boolean |
equals(java.lang.Object obj) |
|
Length |
getBottom() |
Gets the bottom margin as
Length object. |
Length |
getLeft() |
Gets the left margin as
Length object. |
Length |
getRight() |
Gets the right margin as
Length object. |
Length |
getTop() |
Gets the top margin as
Length object. |
int |
hashCode() |
|
static Margin |
parse(java.lang.String value) |
Create a
Margin object from a string representation. |
java.lang.String |
toString() |
Creates a string representation as left-bottom-right-top-tuple with associated suitable metric units, "m", "cm" or "mm".
|
java.lang.String |
toString(Length.Units unit) |
Creates a string representation as left-bottom-right-top-tuple with the specified unit.
|
public Margin(Length left, Length bottom, Length right, Length top)
Margin
object from individual valuespublic Margin(double left, double bottom, double right, double top, Length.Units unit)
Margin
object from values and a common unit.left
- as numerical valuebottom
- as numerical valueright
- as numerical valuetop
- as numerical valueunit
- the unitpublic Margin(Length margin)
Margin
object of equal marginsmargin
- as Length
typepublic Margin(double margin, Length.Units unit)
Margin
object of equal marginsmargin
- as numerical valueunit
- the unitpublic static Margin parse(java.lang.String value)
Margin
object from a string representation.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"public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toString(Length.Units unit)
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object