Component (final JTable table, Object value, boolean isSelected, boolean hasFocus, final int row, final int column) { final DirDiffTableModel model = (DirDiffTableModel)table.getModel(); final DirDiffElementImpl element = model.getElementAt(row); if (element == null) return super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); final int modelColumn = table.convertColumnIndexToModel(column); if (element.isSeparator()) { return new SimpleColoredComponent() { { setIcon(ObjectUtils.chooseNotNull(element.getSourceIcon(), element.getTargetIcon())); append(element.getName()); } @Override protected void doPaint(Graphics2D g) { int offset = 0; int i = 0; final TableColumnModel columnModel = table.getColumnModel(); while (i < column) { offset += columnModel.getColumn(i).getWidth(); i++; } g.translate(-offset, 0); super.doPaint(g); g.translate(offset, 0); } }; } final Component c = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); if (c instanceof JLabel label) { Border border = label.getBorder(); if ((hasFocus || isSelected) && border != null) { label.setBorder(new EmptyBorder(border.getBorderInsets(label))); } label.setIcon(null); final DirDiffOperation op = element.getOperation(); if (modelColumn == (table.getColumnCount() - 1) / 2) { label.setIcon(op.getIcon()); label.setHorizontalAlignment(CENTER); return label; } Color fg = isSelected ? UIUtil.getTableSelectionForeground() : op.getTextColor(); label.setForeground(fg); final DirDiffTableModel.ColumnType type = ((DirDiffTableModel)table.getModel()).getColumnType(column); if (type == DirDiffTableModel.ColumnType.DATE) { label.setHorizontalAlignment(CENTER); } else if (type == DirDiffTableModel.ColumnType.SIZE) { label.setHorizontalAlignment(RIGHT); } else { label.setHorizontalAlignment(LEFT); final String text = label.getText(); label.setText(" " + text); if (text != null && text.trim().length() > 0) { label.setIcon(modelColumn == 0 ? element.getSourceIcon() : element.getTargetIcon()); } } } return c; }