package bluej.utility;

import java.io.File;

import javax.swing.Icon;
import javax.swing.filechooser.FileView;

import bluej.Config;
import bluej.pkgmgr.Package;


| A FileView subclass that enables BlueJ packages to be displayed with a | distinct icon in a FileChooser. | | @author Michael Kolling | @see FileUtility | @version $Id: PackageFileView.java 12533 2014-10-10 12:08:52Z nccb $ | public class PackageFileView extends FileView{ private static Icon bluejProjectIcon; private static Icon greenfootProjectIcon;
| The name of the file. Do nothing special here. Let the system file | view handle this. (All methods that return null get then handled by | the system.) | @Override public String getName(File f) { return null; }
| A human readable description of the file. | @Override public String getDescription(File f) { return null; }
| A human readable description of the type of the file. | @Override public String getTypeDescription(File f) { return null; }
| Here we return proper BlueJ package icons for BlueJ packages. | Everything else gets handled by the system (by returning null). | @Override public Icon getIcon(File f) { if (Config.isMacOS() && f.getAbsolutePath().equals("/net")) { return null; } if (Package.isPackage(f)) if (Config.isGreenfoot()) { if (greenfootProjectIcon == null) { greenfootProjectIcon = Config.getFixedImageAsIcon("greenfoot-project.png"); } return greenfootProjectIcon; } else { if (bluejProjectIcon == null) { bluejProjectIcon = Config.getFixedImageAsIcon("bluej-project.png"); } return bluejProjectIcon; } else { return null; } } }
top, use, map, class PackageFileView

.   getName
.   getDescription
.   getTypeDescription
.   getIcon




86 neLoCode + 12 LoComm