Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.
public final class PageSpec
- Object
- PageSpec
Immutable page geometry in points: paper size and the four margins.
Fields
public static final PageSpec A4 | ISO A4 with 0.75 inch margins. |
public static final PageSpec LETTER | US Letter with one inch margins. |
public final float width | The paper width. |
public final float height | The paper height. |
public final float top | The top margin. |
public final float right | The right margin. |
public final float bottom | The bottom margin. |
public final float left | The left margin. |
public final int columns | The number of text columns, 1 to 12. |
public final float columnGap | The space between columns, in points. |
Constructors
public PageSpec(float width, float height, float top, float right, float bottom, float left) | Creates a page. |
Methods
public PageSpec withColumns(int count, float gap) | A copy with the text set in columns. |
public PageSpec rotated() | A copy turned to the other orientation, margins rotating with the paper. |
public float columnWidth() | The width of one column. |
public float contentWidth() | The width between the margins. |
public float contentHeight() | The height between the margins. |
public boolean equals(Object o) | Two pages are equal when their size and margins are. |
public int hashCode() | A hash consistent with equals. |
Inherited methods
Field details
A4
public static final PageSpec A4ISO A4 with 0.75 inch margins.
LETTER
public static final PageSpec LETTERUS Letter with one inch margins.
width
public final float widthThe paper width.
height
public final float heightThe paper height.
top
public final float topThe top margin.
right
public final float rightThe right margin.
bottom
public final float bottomThe bottom margin.
left
public final float leftThe left margin.
columns
public final int columnsThe number of text columns, 1 to 12.
columnGap
public final float columnGapThe space between columns, in points.
Constructor details
PageSpec
public PageSpec(float width, float height, float top, float right, float bottom, float left)Creates a page.
Parameters
widthfloat- the paper width, at least one inch
heightfloat- the paper height, at least one inch
topfloat- the top margin
rightfloat- the right margin
bottomfloat- the bottom margin
leftfloat- the left margin
Method details
withColumns
public PageSpec withColumns(int count, float gap)A copy with the text set in columns.
Parameters
countint- 1 to 12; fewer are used when the columns would be narrower than 36 points
gapfloat- the space between columns, 0 to 144 points
Returns
the copy
rotated
public PageSpec rotated()A copy turned to the other orientation, margins rotating with the paper.
Returns
the copy
columnWidth
public float columnWidth()The width of one column.
Returns
the width in points
contentWidth
public float contentWidth()The width between the margins.
Returns
the text width
contentHeight
public float contentHeight()The height between the margins.
Returns
the text height
equals
public boolean equals(Object o)Two pages are equal when their size and margins are.
Parameters
oObject- the other object
Returns
true when equal
hashCode
public int hashCode()A hash consistent with
equals.Returns
the hash