A lot of applications show some UI that displays folders of files; also a lot of NetBeans UI is created by showing virtual files in the configuration filesystem.

The basic mechanism is this: Some folder is shown in the UI; files of known types have their own icons, menu items and behavior.

The way NetBeans detects files is this: The "files" being shown are FileObjects - wrappers around java.io.File, or in the case of configuration files, typically wrappers around data stored in some other way, such as inside XML files in modules. What you're actually seeing is Nodes, which are the things that provide actions, localized names, etc. to files or other things.

In between Nodes and FileObjects are DataObjects. A DataObject is like a FileObject?, except that it knows what kind of file is being shown, and there are usually different types of DataObject? (provided by different modules which implement support for file types - for example, the Image module makes it possible to recognize and open .gif and .png files) for files with different extensions, XML files with different DTDs, etc.

Modules that recognize different file types install DataLoaders - factories for file-type-specific DataObjects.

So what really happens is that, when a folder is expanded, they system asks each known DataLoader, "Do you know what this is?" The first one that says "Yes" gets to create the DataObject for the file (in reality the recognition process is a little more optimized than it sounds here, but it adds up to this description).

In order to actually display something for the each file, the system calls DataObject.getNodeDelegate() for each DataObject, and the Nodes are what you actually see in the UI.

Source: NetBeans FAQ