1
2 package hoplugins.teamAnalyzer.ui;
3
4 import hoplugins.teamAnalyzer.SystemManager;
5 import hoplugins.teamAnalyzer.vo.Team;
6
7 import java.awt.Color;
8 import java.awt.Component;
9
10 import javax.swing.DefaultListCellRenderer;
11 import javax.swing.JList;
12
13
14 /***
15 * TODO Missing Class Documentation
16 *
17 * @author TODO Author Name
18 */
19 public class ComboBoxRenderer extends DefaultListCellRenderer {
20
21
22 /***
23 * Creates a new ComboBoxRenderer object.
24 */
25 public ComboBoxRenderer() {
26 }
27
28
29
30
31
32
33
34
35 public Component getListCellRendererComponent(JList list, Object value, int index,
36 boolean isSelected, boolean cellHasFocus) {
37 super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
38
39 Team team = (Team) value;
40
41 if (team == null) {
42 setForeground(list.getForeground());
43
44 return this;
45 }
46
47 if (team.getTeamId() == SystemManager.getLeagueOpponentId()) {
48 setForeground(Color.RED);
49 } else if (team.getTeamId() == SystemManager.getCupOpponentId()) {
50 setForeground(Color.GREEN);
51 } else {
52 setForeground(list.getForeground());
53 }
54
55 return this;
56 }
57 }