Lists, Tables, and Trees
Striped Background Style
Lists, tables, and trees all support an optional striped background style. The striped style
is selected by setting the appropriate client property (
JTree.style) to the value
striped. See the note
below about cell renderer issues, which affect the ability to display a striped
Additional steps may be needed to properly display a JTable using a striped background
in a space that is larger than the table itself. Normally, in that situation, it is
best if the stripes fill the space. However, because the stripes are painted by the
JTable, they will not extend beyond the bounds of the table, which by default are the bounds of
the table rows and columns. The solution is to enable automatic column resizing
setAutoResizeMode()) and filling the viewport height (using
In this situation, it may be useful to limit the width of individual columns by
disabling resizing (using
or setting a maximum width (using
setMaxWidth()) on the
column. The combination of automatic column resizing and non-resizable or limited width columns
allows the table to extend beyond the columns, which enables the striped background to fill
the width of the space.
SideBar Tree Style
VAqua supports an optional sidebar style for trees. This style mimics the style of the Finder sidebar.
The sidebar style
is selected by setting the client property
sideBar. See the note
below about cell renderer issues, which affect the ability to display the sidebar
Filled Tree Cells
Normally, a tree cell renderer will be sized at the preferred size of the renderer component.
VAqua supports an option to expand tree cells to fill the remaining width of the row.
This option is selected by setting the client property
JTree.isCellFilled to (Boolean)
This option does not currently affect the size of the cell editor.
Cell Renderer Issues
Several background styles supported by VAqua, including some default styles, require the willing or unwilling cooperation of the cell renderers to avoid painting over the style-created background (for example, the stripes of a striped style, the selected row background, or the sidebar custom background). In general, a cell renderer should avoid painting a background (a translucent background might be acceptable). In some cases, VAqua will override the cell renderer background color to force it to be consistent with the overall background. Direct use of the default cell renderers should work properly.