1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.gui; |
22 |
|
|
23 |
|
import java.awt.Component; |
24 |
|
import java.util.List; |
25 |
|
|
26 |
|
import javax.swing.DefaultListCellRenderer; |
27 |
|
import javax.swing.JComponent; |
28 |
|
import javax.swing.JList; |
29 |
|
|
30 |
|
|
31 |
|
|
32 |
|
|
33 |
|
@see |
34 |
|
|
35 |
|
|
36 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 5 |
Complexity Density: 1 |
|
37 |
|
public class ComboBoxTooltipRenderer extends DefaultListCellRenderer |
38 |
|
{ |
39 |
|
private static final long serialVersionUID = 1L; |
40 |
|
|
41 |
|
List<String> tooltips; |
42 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 4 |
Complexity Density: 1 |
|
43 |
0 |
@Override... |
44 |
|
public Component getListCellRendererComponent(JList list, Object value, |
45 |
|
int index, boolean isSelected, boolean cellHasFocus) |
46 |
|
{ |
47 |
|
|
48 |
0 |
JComponent comp = (JComponent) super.getListCellRendererComponent(list, |
49 |
|
value, index, isSelected, cellHasFocus); |
50 |
|
|
51 |
0 |
if (-1 < index && null != value && null != tooltips) |
52 |
|
{ |
53 |
0 |
list.setToolTipText(tooltips.get(index)); |
54 |
|
} |
55 |
0 |
return comp; |
56 |
|
} |
57 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
58 |
0 |
public void setTooltips(List<String> tips)... |
59 |
|
{ |
60 |
0 |
this.tooltips = tips; |
61 |
|
} |
62 |
|
} |