public void paint(Graphics2D graphics) {
int width = getWidth();
int height = getHeight();
TableViewHeader tableViewHeader = (TableViewHeader)getComponent();
Color backgroundColor = null;
Color bevelColor = null;
Color borderColor = null;
if (tableViewHeader.isEnabled()) {
backgroundColor = this.backgroundColor;
bevelColor = this.bevelColor;
borderColor = this.borderColor;
} else {
backgroundColor = disabledBackgroundColor;
bevelColor = disabledBevelColor;
borderColor = disabledBorderColor;
}
graphics.setStroke(new BasicStroke());
graphics.setPaint(new GradientPaint(width / 2, 0, bevelColor,
width / 2, height, backgroundColor));
graphics.fillRect(0, 0, width, height);
// Paint the border
graphics.setPaint(borderColor);
graphics.drawLine(0, height - 1, width, height - 1);
// Paint the content
TableView tableView = tableViewHeader.getTableView();
if (tableView != null) {
TableView.ColumnSequence columns = tableView.getColumns();
Sequence<Integer> columnWidths =
TerraTableViewSkin.getColumnWidths(columns, getWidth());
TableViewHeader.DataRenderer dataRenderer = tableViewHeader.getDataRenderer();
int cellX = 0;
for (int columnIndex = 0, columnCount = columns.getLength();
columnIndex < columnCount; columnIndex++) {
TableView.Column column = columns.get(columnIndex);