3 import java.awt.Component;
6 import javax.swing.DefaultListCellRenderer;
7 import javax.swing.JComponent;
8 import javax.swing.JList;
11 * A helper class to render a combobox with tooltips
14 * ://stackoverflow.com/questions/480261/java-swing-mouseover-text-on-jcombobox
17 public class ComboBoxTooltipRenderer extends DefaultListCellRenderer
19 private static final long serialVersionUID = 1L;
21 List<String> tooltips;
24 public Component getListCellRendererComponent(JList list, Object value,
25 int index, boolean isSelected, boolean cellHasFocus)
28 JComponent comp = (JComponent) super.getListCellRendererComponent(list,
29 value, index, isSelected, cellHasFocus);
31 if (-1 < index && null != value && null != tooltips)
33 list.setToolTipText(tooltips.get(index));
38 public void setTooltips(List<String> tips)