Component (JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { if (value == null) return myWrapperPanel; // null erroneously comes from JPanel.getAccessibleChild RevisionItem r = (RevisionItem)value; LabelsAndColor labelsAndColor = getLabelsAndColor(r); final Period p = getMyModel(table).getPeriod(r); if (p == null) { myPeriodLabel.setVisible(false); } else { myPeriodLabel.setVisible(true); myPeriodLabel.setCaption(p.getDisplayString()); } myBorder.set(row == table.getModel().getRowCount() - 1); myDateLabel.setText(ensureString(DateFormatUtil.formatDateTime(r.revision.getTimestamp()))); myFilesCountLabel.setText(ensureString(labelsAndColor.filesCount)); myTitleLabel.setFont(myTitleLabel.getFont().deriveFont(labelsAndColor.isNamed ? Font.BOLD : Font.PLAIN)); myTitleLabel.setText(ensureString(labelsAndColor.title)); JComponent orig = (JComponent)myTemplate.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); if (labelsAndColor.label == null) { myLabelPanel.setVisible(false); } else { myLabelPanel.setVisible(true); myLabelLabel.setBackground(labelsAndColor.label.second); myLabelContainer.set(labelsAndColor.label.second); myLabelLabel.setText(ensureString(labelsAndColor.label.first)); } Color fg = orig.getForeground(); Color bg = isSelected && !table.isFocusOwner() ? UIUtil.getListUnfocusedSelectionBackground() : orig.getBackground(); myDateLabel.setForeground(isSelected ? fg : JBColor.GRAY); myFilesCountLabel.setForeground(myDateLabel.getForeground()); myTitleLabel.setForeground(isSelected || labelsAndColor.isNamed ? fg : JBColor.DARK_GRAY); myItemPanel.setBackground(bg); myWrapperPanel.doLayout(); int height = myWrapperPanel.getPreferredSize().height; //table.setRowHeight causes extra repaint of the table, so we try to avoid it. if (table.getRowHeight(row) != height && height > 0) { table.setRowHeight(row, height); } return myWrapperPanel; }