Like separators, borders are used to visually partition application content. Like Separator, the Border class provides an optional title property that can be used to assign a heading to the border. However, unlike separators, borders are containers. A border accepts a single content component that it sizes to fit its available client area.
The example below shows two Border components, each of which contains a label. The border on the left has a title and showcases the default border style. The border on the left has no title and applies some custom style values:
The BXML for this example is shown below:
<Window title="Borders" maximized="true" xmlns:bxml="http://pivot.apache.org/bxml" xmlns="org.apache.pivot.wtk"> <TablePane styles="{horizontalSpacing:10}"> <columns> <TablePane.Column width="1*"/> <TablePane.Column width="1*"/> </columns> <TablePane.Row height="1*"> <Border title="Border 1" styles="{padding:2}"> <Label text="Default border with title" styles="{horizontalAlignment:'center', verticalAlignment:'center', wrapText:true}"/> </Border> <Border styles="{color:'#ff0000', titleColor:'#000000', thickness:10, cornerRadii:20, padding:2}"> <Label text="Custom border with 10-pixel thick red border, rounded corners, and no title" styles="{horizontalAlignment:'center', verticalAlignment:'center', wrapText:true}"/> </Border> </TablePane.Row> </TablePane> </Window>
Since this example contains no logic, there is no associated Java source.
Next: Stack Panes