01: package de.java2html.gui;
02:
03: import java.awt.Component;
04:
05: import javax.swing.DefaultListCellRenderer;
06: import javax.swing.JList;
07:
08: public abstract class AbstractSimpleListCellRenderer extends
09: DefaultListCellRenderer {
10:
11: public Component getListCellRendererComponent(JList list,
12: Object value, int index, boolean isSelected,
13: boolean cellHasFocus) {
14: super .getListCellRendererComponent(list, value, index,
15: isSelected, cellHasFocus);
16: setText(getLabel(value));
17: return this ;
18: }
19:
20: protected abstract String getLabel(Object value);
21:
22: }
|