01: /*
02: This library is free software; you can redistribute it and/or
03: modify it under the terms of the GNU General Public
04: License as published by the Free Software Foundation; either
05: version 2 of the license, or (at your option) any later version.
06: */
07:
08: package org.gjt.jclasslib.browser.config.classpath;
09:
10: import javax.swing.*;
11: import java.awt.*;
12:
13: /**
14: Cell renderer for the list in the <tt>ClasspathSetupDialog</tt>.
15:
16: @author <a href="mailto:jclasslib@ej-technologies.com">Ingo Kegel</a>
17: @version $Revision: 1.1 $ $Date: 2003/08/18 08:10:15 $
18: */
19: public class ClasspathCellRenderer extends DefaultListCellRenderer {
20:
21: public Component getListCellRendererComponent(JList list,
22: Object value, int index, boolean isSelected,
23: boolean cellHasFocus) {
24: ClasspathEntry entry = (ClasspathEntry) value;
25: super .getListCellRendererComponent(list, entry.getFileName(),
26: index, isSelected, cellHasFocus);
27:
28: Icon icon;
29: if (entry instanceof ClasspathDirectoryEntry) {
30: icon = UIManager.getIcon("FileView.directoryIcon");
31: } else {
32: icon = UIManager.getIcon("FileView.fileIcon");
33: }
34: setIcon(icon);
35:
36: return this;
37: }
38: }
|