Component (final JList list, final Object value, final int index, final boolean isSelected, final boolean cellHasFocus) { clear(); myInList = index >= 0; if (index >= 0) { Object obj1 = myComboBox.getItemAt(index); myChecked = obj1 != null && obj1.equals(myComboBox.getSelectedItem()); } else { myChecked = false; } int indent = 0; if (myInList) { final TreePath path = getTreeModelWrapper().getPathForRow(index); indent = (path.getPathCount() - 1 - (myShowRootNode ? 0 : 1)) * INDENT; } setIpad(new Insets(1, !myInList || myEditable ? 5 : 5 + indent, 1, 5)); setIcon(getValueIcon(value, index)); setIconOpaque(true); myEditable = myComboBox.isEditable(); setForeground(isSelected ? list.getSelectionForeground() : list.getForeground()); setBackground(isSelected ? list.getSelectionBackground() : list.getBackground()); if (value instanceof CustomPresentation) { ((CustomPresentation)value).append(this, index); } else { if (value == null) { if (index == -1 && myDefaultText != null) { append(myDefaultText, SimpleTextAttributes.GRAY_ATTRIBUTES); } else { append(""); } } else { //noinspection HardCodedStringLiteral append(value.toString()); } } setSelected(isSelected); setFont(list.getFont()); return this; }