Component (JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { value = column == 0 ? ((Pair<?, ?>)value).first : ((Pair<?, ?>)value).second; if (value instanceof Boolean) { TableCellRenderer renderer = table.getDefaultRenderer(Boolean.class); if (renderer != null) { JCheckBox box = (JCheckBox)renderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); box.setHorizontalAlignment(SwingConstants.LEFT); return box; } } final JLabel label = new JLabel(value == null ? "" : value.toString()); final JPanel panel = simplePanel(label); if (value instanceof Color c) { label.setText( String.format(" [%d,%d,%d] #%s", c.getRed(), c.getGreen(), c.getBlue(), StringUtil.toUpperCase(ColorUtil.toHex(c)))); Color fg = ColorUtil.isDark(c) ? Gray.xFF : Gray.x00; label.setForeground(fg); panel.setBackground(c); return panel; } else if (value instanceof Icon) { try { final Icon icon = new IconWrap((Icon)value); if (icon.getIconHeight() <= 20) { label.setIcon(icon); } label.setText(String.format("(%dx%d) %s)", icon.getIconWidth(), icon.getIconHeight(), label.getText())); } catch (Throwable e1) {// } return panel; } else if (value instanceof Border) { try { final Insets i = ((Border)value).getBorderInsets(null); label.setText(String.format("[%d, %d, %d, %d] %s", i.top, i.left, i.bottom, i.right, label.getText())); return panel; } catch (Exception ignore) { } } return super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); }