public Component getTableCellRendererComponent( JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { final Color color = UIUtil.getTableFocusCellBackground(); Component component; T t = (T) value; try { UIManager.put(UIUtil.TABLE_FOCUS_CELL_BACKGROUND_PROPERTY, table.getSelectionBackground()); component = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); setText(t != null ? getItemText(t) : ""); if (component instanceof JLabel) { ((JLabel) component).setBorder(noFocusBorder); } } finally { UIManager.put(UIUtil.TABLE_FOCUS_CELL_BACKGROUND_PROPERTY, color); } final MyTableModel model = (MyTableModel) table.getModel(); component.setEnabled( ElementsChooser.this.isEnabled() && (myColorUnmarkedElements ? model.isElementMarked(row) : true)); final ElementProperties properties = myElementToPropertiesMap.get(t); if (component instanceof JLabel) { final Icon icon = properties != null ? properties.getIcon() : t != null ? getItemIcon(t) : null; JLabel label = (JLabel) component; label.setIcon(icon); label.setDisabledIcon(icon); } component.setForeground( properties != null && properties.getColor() != null ? properties.getColor() : (isSelected ? table.getSelectionForeground() : table.getForeground())); return component; }
public Component getTableCellRendererComponent( JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { Component component = myDelegate.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); component.setEnabled(ElementsChooser.this.isEnabled()); if (component instanceof JComponent) { ((JComponent) component).setBorder(null); } return component; }