A BScrollPane is a WidgetContainer with up to five children: an arbitrary "content" Widget that
fills most of the BScrollPane, optional "row header" and "column header" Widgets along the left
and top edges, respectively, and optional BScrollBars along the right and bottom edges. It
displays only a portion of the content, row header, and column header Widgets, and allows the user
to scroll through them by means of the two BScrollBars.
If the BScrollPane does not have a horizontal and/or vertical scrollbar, then by default it will
force the corresponding dimension of the content and header Widgets to exactly match the size of the
visible area. For example, if the content is a BTextArea with word wrap enabled, you would normally
only have a vertical scrollbar. The width of the BTextArea should then be forced to exactly
match the width of the visible area, so that words will wrap at the correct place. You can
override this behavior by calling setForceWidth() and setForceHeight(). For example, you might
want to control the scroll position through some external means, in which case the BScrollPane
would not provide scrollbars but should still allow the content Widget to be its preferred size.
BScrollPane
public BScrollPane()
Create a new BScrollPane with no content or header Widgets. The horizontal and vertical
scrollbar policies default to SCROLLBAR_AS_NEEDED.
BScrollPane
public BScrollPane(BScrollPane.ScrollbarPolicy horizontalPolicy,
BScrollPane.ScrollbarPolicy verticalPolicy)
Create a new BScrollPane with no content or header Widgets.
horizontalPolicy
- specifies when the horizontal scrollbar should be displayed. This should
be equal to SCROLLBAR_ALWAYS, SCROLLBAR_AS_NEEDED, or SCROLLBAR_NEVER.verticalPolicy
- specifies when the vertical scrollbar should be displayed. This should
be equal to SCROLLBAR_ALWAYS, SCROLLBAR_AS_NEEDED, or SCROLLBAR_NEVER.
BScrollPane
public BScrollPane(Widget contentWidget)
Create a new BScrollPane with the specified Widget as its content. The horizontal and vertical
scrollbar policies default to SCROLLBAR_AS_NEEDED.
contentWidget
- the Widget to use as the content of the BScrollPane
BScrollPane
public BScrollPane(Widget contentWidget,
BScrollPane.ScrollbarPolicy horizontalPolicy,
BScrollPane.ScrollbarPolicy verticalPolicy)
Create a new BScrollPane with the specified Widget as its content.
contentWidget
- the Widget to use as the content of the BScrollPanehorizontalPolicy
- specifies when the horizontal scrollbar should be displayed. This should
be equal to SCROLLBAR_ALWAYS, SCROLLBAR_AS_NEEDED, or SCROLLBAR_NEVER.verticalPolicy
- specifies when the vertical scrollbar should be displayed. This should
be equal to SCROLLBAR_ALWAYS, SCROLLBAR_AS_NEEDED, or SCROLLBAR_NEVER.
getColHeader
public Widget getColHeader()
Get the column header Widget.
getContent
public Widget getContent()
Get the content Widget.
getForceHeight
public boolean getForceHeight()
Get whether the BScrollPane should force the height of the content and row header Widgets to
exactly match the height of the visible area. By default, this is true if the vertical scrollbar
policy was initialized to SCROLLBAR_NEVER, and false otherwise.
Note that even if this option is enabled, the BScrollPane will never make the content Widget
smaller than its minimum size or larger than its maximum size.
getForceWidth
public boolean getForceWidth()
Get whether the BScrollPane should force the width of the content and column header Widgets to
exactly match the width of the visible area. By default, this is true if the horizontal scrollbar
policy was initialized to SCROLLBAR_NEVER, and false otherwise.
Note that even if this option is enabled, the BScrollPane will never make the content Widget
smaller than its minimum size or larger than its maximum size.
getHorizontalScrollBar
public BScrollBar getHorizontalScrollBar()
Get the horizontal BScrollBar.
getHorizontalScrollbarPolicy
public BScrollPane.ScrollbarPolicy getHorizontalScrollbarPolicy()
Get the horizontal scrollbar policy. This will be either SCROLLBAR_ALWAYS, SCROLLBAR_AS_NEEDED,
or SCROLLBAR_NEVER.
getMinimumSize
public Dimension getMinimumSize()
Get the smallest size at which this Widget can reasonably be drawn. When a WidgetContainer lays out
its contents, it will attempt never to make this Widget smaller than its minimum size.
- getMinimumSize in interface Widget
getPreferredSize
public Dimension getPreferredSize()
Get the preferred size at which this Widget will look best. When a WidgetContainer lays out
its contents, it will attempt to make this Widget as close as possible to its preferred size.
- getPreferredSize in interface Widget
getPreferredViewSize
public Dimension getPreferredViewSize()
Get the preferred size for the content's view area. This may be null, in which case the preferred
view size is equal to the preferred size of the content Widget.
getRowHeader
public Widget getRowHeader()
Get the row header Widget.
getVerticalScrollBar
public BScrollBar getVerticalScrollBar()
Get the vertical BScrollBar.
getVerticalScrollbarPolicy
public BScrollPane.ScrollbarPolicy getVerticalScrollbarPolicy()
Get the vertical scrollbar policy. This will be either SCROLLBAR_ALWAYS, SCROLLBAR_AS_NEEDED,
or SCROLLBAR_NEVER.
getViewSize
public Dimension getViewSize()
Get the current size of the content's view area.
layoutChildren
public void layoutChildren()
Layout the child Widgets. This may be invoked whenever something has changed (the size of this
WidgetContainer, the preferred size of one of its children, etc.) that causes the layout to no
longer be correct. If a child is itself a WidgetContainer, its layoutChildren() method will be
called in turn.
- layoutChildren in interface WidgetContainer
remove
public void remove(Widget widget)
Remove a child Widget from this container. The scrollbars are built into the scroll pane and
may never be removed, although they can be hidden by setting the appropriate scrollbar policy
to SCROLLBAR_NEVER.
- remove in interface WidgetContainer
removeAll
public void removeAll()
Remove the content, row header, and column header Widgets from this container. The scrollbars
are built into the scroll pane and may never be removed, although they can be hidden by setting
the appropriate scrollbar policy to SCROLLBAR_NEVER.
- removeAll in interface WidgetContainer
setBackground
public void setBackground(Color background)
Set the background color of this Widget. If this is set to null, the Widget will use the background
color of its parent WidgetContainer.
- setBackground in interface Widget
setColHeader
public void setColHeader(Widget widget)
Set the column header Widget.
setContent
public void setContent(Widget widget)
Set the content Widget.
setForceHeight
public void setForceHeight(boolean force)
Set whether the BScrollPane should force the height of the content and row header Widgets to
exactly match the height of the visible area. By default, this is true if the vertical scrollbar
policy was initialized to SCROLLBAR_NEVER, and false otherwise.
Note that even if this option is enabled, the BScrollPane will never make the content Widget
smaller than its minimum size or larger than its maximum size.
setForceWidth
public void setForceWidth(boolean force)
Set whether the BScrollPane should force the width of the content and column header Widgets to
exactly match the width of the visible area. By default, this is true if the horizontal scrollbar
policy was initialized to SCROLLBAR_NEVER, and false otherwise.
Note that even if this option is enabled, the BScrollPane will never make the content Widget
smaller than its minimum size or larger than its maximum size.
setHorizontalScrollbarPolicy
public void setHorizontalScrollbarPolicy(BScrollPane.ScrollbarPolicy policy)
Set the horizontal scrollbar policy. This should be either SCROLLBAR_ALWAYS, SCROLLBAR_AS_NEEDED,
or SCROLLBAR_NEVER.
setPreferredViewSize
public void setPreferredViewSize(Dimension size)
Set the preferred size for the content's view area. This may be null, in which case the preferred
view size is equal to the preferred size of the content Widget.
setRowHeader
public void setRowHeader(Widget widget)
Set the row header Widget.
setVerticalScrollbarPolicy
public void setVerticalScrollbarPolicy(BScrollPane.ScrollbarPolicy policy)
Set the vertical scrollbar policy. This should be either SCROLLBAR_ALWAYS, SCROLLBAR_AS_NEEDED,
or SCROLLBAR_NEVER.