What are the basic things I should know about NetBeans' architecture to get started creating NetBeans Platform applications?

Apache NetBeans Wiki Index

Note: These pages are being reviewed.

The most important thing you need when creating applications on top of the NetBeans Platform (a.k.a. NetBeans RCP) is to know what you are trying to do clearly, so you can find what you need to get started quickly. Here are some basic NetBeans factoids which will either answer some questions or whet your appetite for more information:

  • A module is a JAR file with some special manifest entries. The NetBeans IDE (5.0 and up) has lots of support for building modules.

  • Modules usually affect the system by putting entries in an XML file inside their JAR, which the system reads.

  • You can add to, remove from, change or completely remove menus from the main window, toolbars and other things from a module

  • To show your own tabs in the main window, you will want to subclass TopComponent

  • The windowing system provides facilities for tracking selection, and actions can be made sensitive to selection. Selection typically centers around use of Nodes; it is also possible to have context sensitive actions without Nodes.

  • It is possible to build tree and other views of objects very quickly using Nodes in conjunction with Explorer Views

  • Many pieces of NetBeans UI are really views of some folder in the configuration filesystem which modules install things into

  • The configuration filesystem is read-write, and changes can be saved to the user’s settings directory

  • Applications built on NetBeans do not have to be IDE-like - there is plenty of support for editing files available in the Editor module and friends, but you do not even have to include those modules in your application if you do not use them

A lot of things in NetBeans are based around file recognition and using files to provide Java objects. Even if your application has nothing to do with editing files, this may still be very useful to you, since the same mechanism that recognizes/displays a user’s files on disk also recognizes/displays configuration data (which may not even be files in the traditional sense at all), and such "files" can actually be factories for whatever kind of object you want (and that way you get persistence of those files for free).

For example, the FeedReader tutorial simply serializes POJO Feed objects into the configuration filesystem , and its whole UI consists of aiming a standard tree component at a folder full of those objects, and providing a few actions to let the user create more of them. When the application shuts down, it does not need to any special code for persisting them, it is all automatic.

For more information about how that works, see the section on file recognition.

One of the most basic and important things to know about is how modules register objects - this is mainly done through a configuration file inside the module’s jar file (if you are using NetBeans 5.0 or greater’s module building support, you can usually avoid hand-editing this file). Most things a module does to influence the environment are declarative rather than programmatic - in other words, you put some text in an XML file, or an entry in a jar manifest, or a file in some specific place in the module jar, and your functionality will be discovered when the system starts up - as opposed to writing java code.

Two of the most common needs are opening custom Swing components in the UI, and installing actions in the main menu .

Other basic topics that are worth reading to get the lay of the land are:

There are various tutorials, and the canonical reference to NetBeans APIs is the API javadoc.