@Override
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.setPaint(new GradientPaint(width / 2f, 0, bevelColor,
width / 2f, height, backgroundColor));
graphics.fillRect(0, 0, width, height);
// Paint the border
graphics.setPaint(borderColor);
GraphicsUtilities.drawLine(graphics, 0, height - 1, width, Orientation.HORIZONTAL);
// Paint the content
TableView tableView = tableViewHeader.getTableView();
if (tableView != null) {
TableView.ColumnSequence columns = tableView.getColumns();
TableViewHeader.DataRenderer dataRenderer = tableViewHeader.getDataRenderer();
int headerX = 0;
for (int columnIndex = 0, columnCount = columns.getLength();
columnIndex < columnCount; columnIndex++) {
TableView.Column column = columns.get(columnIndex);