Component (JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); final Pair<String, Icon> pair = (Pair<String, Icon>)value; final @NlsSafe String text = Pair.getFirst(pair); setText(text); final Dimension dimension = getPreferredSize(); if (!validity.value(text)) { setFont(getFont().deriveFont(Font.ITALIC)); setForeground(JBColor.RED); } setIcon(Pair.getSecond(pair)); setPreferredSize(new Dimension(-1, dimension.height)); return this; }