コード例 #1
0
 public Icon getIcon(File obj) {
   String extension = FilenameUtils.getExtension(obj.getName());
   if (extension != null) {
     return IconManager.instance().getIconForExtension(extension);
   }
   return null;
 }
コード例 #2
0
 @Override
 public Component getListCellRendererComponent(
     JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
   super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
   String extension = FilenameUtils.getExtension(value.toString());
   if (extension != null) {
     setIcon(IconManager.instance().getIconForExtension(extension));
   }
   return this;
 }