Align controls how a component is positioned inside the space allocated to it by a layout. It is particularly useful when cells have more width or height than their contents.
For the complete API reference, visit https://doc.jdance.org.
Horizontal alignment determines whether a component is placed at the start, center, or end of the available width. Alignment belongs to the layout cell, not to the text itself.
The preview above uses a small amount of space so the behavior is visible even in a narrow documentation panel.
Vertical alignment matters when a cell has extra height. Combining horizontal and vertical alignment gives fine control without absolute positioning.
A centered component is still subject to its containing layout. If the layout becomes narrower, the available positioning space also changes. Use alignment for placement and padding or gap for spacing.
The same idea can also be expressed as a compact Java snippet without requiring a live preview.
A common mistake is to treat alignment as a substitute for sizing. Give the containing layout enough width or height before expecting LEFT, CENTER or RIGHT to produce visibly different positions.
These examples focus on the day-to-day use of Align. The full API documentation contains additional options, inherited properties and complete method signatures.
Visit https://doc.jdance.org for the full reference.