01: package tijmp.ui;
02:
03: import java.awt.Component;
04: import java.lang.reflect.Field;
05: import javax.swing.DefaultListCellRenderer;
06: import javax.swing.JList;
07:
08: /** A renderer that turns classes into readable strings.
09: */
10: public class FieldRenderer extends DefaultListCellRenderer {
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: Field c = (Field) value;
17: setText(c.toString());
18: return this;
19: }
20: }
|