ScrollBoxLayout − a container that supports content scrolling.

gui scrollBox

Component XML-name: scrollBox

An example container description in a screen XML-descriptor:

<groupBox caption="Order" width="300" height="170">
    <scrollBox width="100%" height="100%" spacing="true" margin="true">
        <dateField dataContainer="orderDc" property="date" caption="Date"/>
        <lookupField dataContainer="orderDc" property="customer" optionsContainer="customersDc" caption="Customer"/>
        <textField dataContainer="orderDc" property="amount" caption="Amount"/>
  • The components placement direction can be defined by orientation attribute − horizontal or vertical. Default is vertical.

  • scrollBars attribute enables configuring scroll bars. It can be horizontal, vertical – for horizontal and vertical scrolling respectively, both – for scrolling in both directions. Setting the value to none forbids scrolling in any direction.

  • contentHeight - sets content height.

  • contentWidth - sets content width.

  • contentMaxHeight - sets maximum CSS height for content, for example, "640px", "100%".

  • contentMinHeight - sets minimum CSS height for content, for example, "640px", "auto".

  • contentMaxWidth - sets maximum CSS width for content, for example, "640px", "100%".

  • contentMinWidth - sets minimum CSS width for content, for example, "640px", "auto".

    <scrollBox contentMinWidth="600px"
        <textArea height="150px"
gui scrollBox 1
Figure 23. Full-size scrollBox with textArea inside
gui scrollBox 2
Figure 24. Scroll bar appears to maintain the content width when the window is resized

It is recommended to set the content width and height. Otherwise, the components placed in the scrollBox should have fixed size or default size.

Do not set the size of nested components to height="100%" or width="100%" if the content width and height are not set.

You can use keyboard shortcuts in ScrollBox. Set the shortcut and the action to be performed using the addShortcutAction() method:

scrollBox.addShortcutAction(new ShortcutAction("SHIFT-A", shortcutTriggeredEvent ->
                .withCaption("SHIFT-A action")