* Update the style.
*
* @param c the component.
*/
private void updateStyle(JTable c) {
SeaGlassContext context = getContext(c, ENABLED);
SynthStyle oldStyle = style;
style = SeaGlassLookAndFeel.updateStyle(context, this);
selectionActiveBottomBorderColor = UIManager.getColor("seaGlassTableSelectionActiveBottom");
selectionInactiveBottomBorderColor = UIManager.getColor("seaGlassTableSelectionInactiveBottom");
transparentColor = UIManager.getColor("seaGlassTransparent");
if (style != oldStyle) {
table.remove(rendererPane);
rendererPane = createCustomCellRendererPane();
table.add(rendererPane);
context.setComponentState(ENABLED | SELECTED);
Color sbg = table.getSelectionBackground();
if (sbg == null || sbg instanceof UIResource) {
table.setSelectionBackground(style.getColor(context, ColorType.TEXT_BACKGROUND));
}
Color sfg = table.getSelectionForeground();
if (sfg == null || sfg instanceof UIResource) {
table.setSelectionForeground(style.getColor(context, ColorType.TEXT_FOREGROUND));
}
context.setComponentState(ENABLED);
Color gridColor = table.getGridColor();
if (gridColor == null || gridColor instanceof UIResource) {
gridColor = (Color) style.get(context, "Table.gridColor");
if (gridColor == null) {
gridColor = style.getColor(context, ColorType.FOREGROUND);
}
table.setGridColor(gridColor);
}
useTableColors = style.getBoolean(context, "Table.rendererUseTableColors", true);
useUIBorder = style.getBoolean(context, "Table.rendererUseUIBorder", true);
Object rowHeight = style.get(context, "Table.rowHeight");
if (rowHeight != null) {
LookAndFeel.installProperty(table, "rowHeight", rowHeight);
}
boolean showGrid = style.getBoolean(context, "Table.showGrid", true);
if (!showGrid) {
table.setShowGrid(false);
}
Dimension d = table.getIntercellSpacing();
// if (d == null || d instanceof UIResource) {
if (d != null) {
d = (Dimension) style.get(context, "Table.intercellSpacing");
}
alternateColor = (Color) style.get(context, "Table.alternateRowColor");
if (d != null) {
table.setIntercellSpacing(d);
}
table.setOpaque(false);
if (alternateColor != null) {
table.setShowHorizontalLines(false);
}
// Make header column extend the width of the viewport (if there is
// a viewport).
table.getTableHeader().setBorder(createTableHeaderEmptyColumnPainter(table));
setViewPortListeners(table);
if (oldStyle != null) {
uninstallKeyboardActions();
installKeyboardActions();
}
}
context.dispose();
}