001// License: GPL. For details, see LICENSE file.
002package org.openstreetmap.josm.gui.conflict.pair;
003
004import java.awt.Component;
005
006import javax.swing.JLabel;
007import javax.swing.JList;
008import javax.swing.ListCellRenderer;
009
010import org.openstreetmap.josm.gui.conflict.ConflictColors;
011
012public class ComparePairListCellRenderer extends JLabel implements ListCellRenderer {
013    public ComparePairListCellRenderer() {
014        setOpaque(true);
015    }
016    @Override
017    public Component getListCellRendererComponent(
018            JList list,
019            Object value,
020            int index,
021            boolean isSelected,
022            boolean cellHasFocus)
023    {
024        ComparePairType type = (ComparePairType)value;
025        setText(type.getDisplayName());
026        setBackground(isSelected ? ConflictColors.BGCOLOR_SELECTED.get() : ConflictColors.BGCOLOR.get());
027        setForeground(ConflictColors.FGCOLOR.get());
028        return this;
029    }
030}