1 19 20 package org.netbeans.modules.tasklist.core; 21 22 import org.netbeans.modules.tasklist.client.SuggestionPriority; 23 24 import java.awt.Color ; 25 import java.awt.Component ; 26 import javax.swing.DefaultListCellRenderer ; 27 import javax.swing.JList ; 28 29 34 public class PriorityListCellRenderer extends DefaultListCellRenderer { 35 private static final long serialVersionUID = 1; 36 37 private static final String [] TAGS = SuggestionPriority.getPriorityNames(); 38 39 43 public static final Color [] COLORS = { 44 new Color (221, 0, 0), 45 new Color (255, 128, 0), 46 Color.black, 47 new Color (0, 187, 0), 48 new Color (0, 128, 0) 49 }; 50 51 public Component getListCellRendererComponent(JList list, Object value, 52 int index, boolean isSelected, boolean cellHasFocus) { 53 super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); 54 if (value instanceof SuggestionPriority) { 55 SuggestionPriority prio = (SuggestionPriority) value; 56 setText(TAGS[prio.intValue() - 1]); 57 if (!isSelected) { 58 setForeground(COLORS[prio.intValue() - 1]); 59 } 60 } 61 return this; 62 } 63 } 64 | Popular Tags |