Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.

public final class PageSpec

  1. Object
  2. PageSpec
Immutable page geometry in points: paper size and the four margins.

Fields

public static final PageSpec A4ISO A4 with 0.75 inch margins.
public static final PageSpec LETTERUS Letter with one inch margins.
public final float widthThe paper width.
public final float heightThe paper height.
public final float topThe top margin.
public final float rightThe right margin.
public final float bottomThe bottom margin.
public final float leftThe left margin.
public final int columnsThe number of text columns, 1 to 12.
public final float columnGapThe 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 A4
ISO A4 with 0.75 inch margins.

LETTER

public static final PageSpec LETTER
US Letter with one inch margins.

width

public final float width
The paper width.

height

public final float height
The paper height.

top

public final float top
The top margin.

bottom

public final float bottom
The bottom margin.

left

public final float left
The left margin.

columns

public final int columns
The number of text columns, 1 to 12.

columnGap

public final float columnGap
The 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

width float
the paper width, at least one inch
height float
the paper height, at least one inch
top float
the top margin
right float
the right margin
bottom float
the bottom margin
left float
the left margin

Method details

withColumns

public PageSpec withColumns(int count, float gap)
A copy with the text set in columns.

Parameters

count int
1 to 12; fewer are used when the columns would be narrower than 36 points
gap float
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

o Object
the other object

Returns

true when equal

hashCode

public int hashCode()
A hash consistent with equals.

Returns

the hash