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