@Override public Component getListCellRendererComponent( JList list, Object value, int rowIndex, boolean isSelected, boolean cellHasFocus) { // Let superclass deal with most of it... super.getListCellRendererComponent(list, value, rowIndex, isSelected, cellHasFocus); T item = getListItem(rowIndex); // Sanity check. if (item == null) { LOGGER.debug("tableModel.getCachedFileAtRow(" + rowIndex + ") RETURNED NULL !"); return null; } QuickSearch<T> search = QuickListDataList.this.getQuickSearch(); boolean matches = !search.isActive() || search.matches(item.toString()); CellLabel label = new CellLabel(); label.setFont(itemFont); label.setText(item.toString()); // label.setToolTipText(""+item); // Set background color depending on whether the row is selected or not, and whether the table // has focus or not if (isSelected) { label.setBackground(selectedItemBackground); label.setForeground(selectedItemForeground); } else { label.setBackground(matches ? itemBackground : ThemeCache.unmatchedBackground); label.setForeground(matches ? itemForeground : ThemeCache.unmatchedForeground); } return label; }