Class BoxPane

  • All Implemented Interfaces:
    java.lang.Iterable<Component>, Sequence<Component>, ConstrainedVisual, Visual
    Direct Known Subclasses:
    ButtonDataRenderer, ListViewItemRenderer, MenuBarItemDataRenderer, TableViewCheckboxCellRenderer, TableViewHeaderDataRenderer, TerraFileBrowserSkin.DriveRenderer, TerraFileBrowserSkin.FileRenderer, TerraVFSBrowserSkin.DriveRenderer, TerraVFSBrowserSkin.FileRenderer, TreeViewNodeRenderer

    public class BoxPane
    extends Container
    Container that arranges components in a line, either vertically or horizontally.

    Layout considerations: Note that by default, a BoxPane does not pass any preferred size information to its components. That means, for example, that the preferred width of a horizontal BoxPane is simply the sum of the preferred widths of its components, plus whatever extra space is dictated by its padding and spacing styles. This is also true in the orthogonal dimension if the fill style is not set: the preferred height of a horizontal BoxPane is the maximum preferred height of its components (plus padding, if any).

    If a BoxPane is given less than its preferred size by its parent container, then the contents will be clipped; if given more than its preferred size, the contents will not be stretched to fill the space.

    This behavior of BoxPane can be useful for "canceling" the layout effects of a parent container and/or to align a component that does not have its own alignment styles. For example, if you place a PushButton in a cell of a TablePane, the button will expand to fill the whole cell. If instead you place the button inside a BoxPane in the cell, it will retain its natural size, and you can set the horizontalAlignment and verticalAlignment styles of the BoxPane to, say, center the button within the cell.

    Setting the fill style to true will cause the BoxPane to completely fill the space allotted by its container in the direction orthogonal to the layout direction. So, for a vertical layout, the width will be the width of its container and the children of the BoxPane will also be sized accordingly (i.e., full width of the space). And so for a horizontal layout, with fill set to true the height of the BoxPane will be the height allotted by its container and the children of the BoxPane will have their heights set accordingly.