1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.xnap.gui.list;
21
22 import java.awt.Component;
23
24 import javax.swing.DefaultListCellRenderer;
25 import javax.swing.JList;
26
27 import org.xnap.chat.ChatProvider;
28
29 /***
30 * Renders the name of a {@link ChatProvider} object.
31 *
32 * @see xnap.gui.ChatProviderPanel
33 */
34 public class ChatProviderCellRenderer extends DefaultListCellRenderer
35 {
36
37
38
39 public ChatProviderCellRenderer()
40 {
41 }
42
43
44
45 public Component getListCellRendererComponent(JList list, Object value,
46 int index,
47 boolean isSelected,
48 boolean cellHasFocus)
49 {
50 super.getListCellRendererComponent(list, value, index, isSelected,
51 cellHasFocus);
52
53 if (value instanceof ChatProvider) {
54 setText(((ChatProvider)value).getName());
55 }
56
57 return this;
58 }
59
60 }
61
62
63