Setting Properties on a Crosstab and on Crosstab Components

You can set properties of the crosstab and of its components to change the appearance of the crosstab. The following table lists common properties that you might set on the crosstab itself.

Property

Description

StartColumn The first column to display in the crosstab
StartRow The first row to display in the crosstab
ColumnHeaderVisible Whether the column header is displayed
RowHeaderVisible Whether the row header is displayed
ColumnVisible Whether a particular column appears in the table
RowVisible Whether a particular row appears in the crosstab
VGridVisible Whether the vertical gridlines appear in the crosstab
HGridVisible Whether the horizontal gridlines appear in the crosstab
CellEditingAllowed Whether users can edit cells in the Java-client crosstab
isIndentEnabled Whether row labels are indented
ColumnHighlighterVisible Whether the column highlighters appear in a Java-client crosstab
RowHighlighterVisible Whether row highlighters appear in a Java-client crosstab
BodyHighlighterVisible Whether body highlighter appears in a Java-client crosstab

Formatting numbers in crosstabs

The properties for formatting numbers in a crosstab component are in the ViewFormat class. To specify number formatting for the entire crosstab, call the setViewFormat method of the crosstab. You can use rules to specify more granular formatting, such as number formatting for a particular measure.

Properties for crosstab components

Each component has properties of its own. To see the properties for each component, look at the javadoc for each component class.

The most important property for a crosstab component is the ViewStyle property. A ViewStyle object specifies the background color, font color and characteristics, and borders of the cells in a crosstab component.

Setting properties on the ViewStyle a crosstab component affects everything that it contains, such as the grid lines, the cells, and so on. To set properties for individual cells, use rules.

Example: Setting the font color for a header

The following example shows how to set the color of the text in the RowHeader, by setting a property on the ViewStyle object.


crosstab.getRowHeader().getViewStyle().setForeground(Color.red);

Example: Setting the background color of the Databody

The following line of code sets the background color of the Databody to blue.


crosstab.getDatabody().getViewStyle().setBackground(Color.blue);