alignmentX

Sets the horizontal alignment along the x axis, where 0.0 aligns to the left, 0.5 centers, and 1.0 aligns to the right. A parent that honors alignment - a vertical BoxLayout - lines its children up by this value, so siblings given the same alignment stay in one column.

A component holding no alignment of its own reports the one its layout manager derives - a BoxLayout derives it from the children present - or the centered default where none is derived. A style that stops setting it writes the alignment the layout derives at that moment. An alignment the component holds is restored only where it differs from the one its layout derives as the style first sets it. An alignment that matches it is read as none.

Parameters

value

the fraction of the component's width the parent lines its children up on; Swing clamps a value outside 0.0..1.0 into that range rather than rejecting it.

See also