Java Utililty Methods JTable Color

List of utility methods to do JTable Color

Description

The list of methods to do JTable Color are organized into topic(s).

Method

ColorgetTableBackgroundColor(boolean colored)
get Table Background Color
if (colored)
    return new Color(0xf4f4f4);
return UIManager.getColor("Table.background");
ColorgetTableGridColor()
get Table Grid Color
return UIManager.getColor("Table.gridColor");
voidpossiblyFixGridColor(JTable table)
Make a table use the right grid color on Windows Vista, when using the Windows Look and Feel.
String laf = UIManager.getLookAndFeel().getClass().getName();
if (laf.endsWith("WindowsLookAndFeel")) {
    if (Color.white.equals(table.getBackground())) {
        Color gridColor = table.getGridColor();
        if (gridColor != null && gridColor.getRGB() <= 0x808080) {
            table.setGridColor(new Color(0xe3e3e3));
ComponentsetBackgroundColor(final Component comp, final JTable table, boolean isSelected)
Set the background colour from the table.
return setBackgroundColor(comp, table, isSelected, null);
ComponentsetColors(final Component comp, final JTable table, boolean isSelected, Color bgColor, Color fgColor)
set Colors
setBackgroundColor(comp, table, isSelected, bgColor);
setForegroundColor(comp, table, isSelected, fgColor);
return comp;
ComponentsetForegroundColor(final Component comp, final JTable table, boolean isSelected, Color fgColor)
set Foreground Color
if (isSelected) {
    comp.setForeground(table.getSelectionForeground());
} else {
    comp.setForeground(fgColor == null ? table.getForeground() : fgColor);
return comp;