1 7 8 package org.gjt.jclasslib.browser.config.classpath; 9 10 import javax.swing.*; 11 import java.awt.*; 12 13 19 public class ClasspathCellRenderer extends DefaultListCellRenderer { 20 21 public Component getListCellRendererComponent( 22 JList list, 23 Object value, 24 int index, 25 boolean isSelected, 26 boolean cellHasFocus) 27 { 28 ClasspathEntry entry = (ClasspathEntry)value; 29 super.getListCellRendererComponent(list, entry.getFileName(), index, isSelected, cellHasFocus); 30 31 Icon icon; 32 if (entry instanceof ClasspathDirectoryEntry) { 33 icon = UIManager.getIcon("FileView.directoryIcon"); 34 } else { 35 icon = UIManager.getIcon("FileView.fileIcon"); 36 } 37 setIcon(icon); 38 39 return this; 40 } 41 } 42 | Popular Tags |