List of usage examples for javax.swing JTable isOpaque
public boolean isOpaque()
From source file:ExtendedTableCellRenderer.java
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { if (isSelected) { super.setForeground(table.getSelectionForeground()); super.setBackground(table.getSelectionBackground()); } else {/*from w ww . ja v a2 s . com*/ super.setForeground((unselectedForeground != null) ? unselectedForeground : table.getForeground()); super.setBackground((unselectedBackground != null) ? unselectedBackground : table.getBackground()); } setFont(table.getFont()); if (hasFocus) { setBorder(UIManager.getBorder("Table.focusCellHighlightBorder")); if (table.isCellEditable(row, column)) { super.setForeground(UIManager.getColor("Table.focusCellForeground")); super.setBackground(UIManager.getColor("Table.focusCellBackground")); } } else { setBorder(NO_FOCUS_BORDER); } setValue(value); Color background = getBackground(); boolean colorMatch = (background != null) && (background.equals(table.getBackground())) && table.isOpaque(); setOpaque(!colorMatch); return this; }