Introducing NetBeans plug-in Development

Contributed By: Amit Kumar Saha

So, you want your NetBeans to do more?

You want to live in NetBeans and hate to minimize it and fire up yet-another application. You want to listen to music, browse the web, check your mail, store your favorite URL's, maintain your daily To-Do's and 'To Be Done' tasks- all from inside NetBeans. So how we do go about adding these all-we-need features?

The NetBeans IDE is a plug-in based development environment. Alternatively, you can say that NetBeans has a modular architecture. In simple terms, we have a base or bare bone IDE and then plug-ins are written to extend the IDE and make it feature rich. The NetBeans Platform is a term used to refer to this base IDE. Most of the functionalities that you see in NetBeans are implemented by the plug-ins.


NetBeans plug-in Module and Related Essential Background

A plug-in module, as the name implies "plugs into" the NetBeans IDE to provide certain specific features and functionalities. The plug-in could have a graphical interface (GUI) or it may not. Just to put the concept of plug-ins into better light, I am sure you have installed more than one Mozilla Firefox plugins to make your browsing experience better.

Some basic terms that you should be acquainted with are reproduced here from

  • NetBeans Platform: The skeleton application that provides everything most applications need and little of what they don't. The NetBeans Platform provides an application's common requirements -- such as menus, document management, and settings -- right out of-the-box. Building an application "on top of NetBeans" means that, instead of writing applications from scratch, you only provide the parts of your application that the NetBeans Platform doesn't already have. At the end of the development cycle, you bundle your application with the NetBeans Platform, saving you time and energy and resulting in a solid, reliable application.
  • System Filesystem: The general registry that contains NetBeans configuration information, built from the layer.xml configuration files of the registered modules. NetBeans stores a wide variety of configuration information in the System Filesystem. For example, the System Filesystem contains a folder called Menu, which contains subfolders with names such as File and Edit. These subfolders contain files that represent Java classes which implement the actions that appear in the "File" and "Edit" menus in the IDE.
  • Module: A group of Java classes that provides an application with a specific feature. The Java classes use the file to declare the module and the layer.xml configuration file to register their functionality in the System Filesystem. In NetBeans terminology, "plugin" is an adjective, while "module" is a noun. There is no discernible difference in meaning between them.
  • NetBeans APIs: The public interfaces and classes which are available to module writers. They are divided into specific APIs for dealing with different types of functionality. The contents and behavior of the Java source packages and its subpackages, as specified in the API reference documentation, are the APIs. For the full NetBeans API List, click here
  • Module Suite: A group of interdependent modules that are deployed together. The IDE helps you to brand the suite -- for example, you can add a splash screen and you can specify the parts of the NetBeans Platform that you don't want your application to provide.

Writing your first plug-in

You will now see how you can write your first ever plugin. What will the plugin do? It just creates another 'tab' beside the 'Start Page' tab in the editor:


No, it is nowhere near pretty, but it serves the purpose of demonstration :-)

Creating a new Module project

  • Create a new module project, name it 'nbmodule-demo'


Check the 'Standalone Module'.


Basic Module Configuration

  1. Code Name Base: replace the 'myorghere' to 'mymodule' to get 'org.mymodule.nbmoduledemo'
  2. Module Display Name: nb-module-demo
  3. Localizing Bundle: Keep the default. It specifies language-specific strings for internationalization
  4. XML Layer: Keep the default. It registers items such as menus and toolbar buttons in the NetBeans System Filesystem.

For 6.5, check "Generate XML Layer"


Click on 'Finish'

The project code structure is generated:


The skeleton module is now ready. Next, we shall add code for specific tasks that we want the module to perform.

  • Add a 'Window Component'
  • Right-click on the 'org.mymodule.nbmoduledemo'
  • Select 'New-> Window Component'


  • New Window
  • Window Position: 'editor', since we are adding a 'tab' to the editor
  • Check the 'Open on Application Start'


  • Choose the class Name Prefix as 'AppUIMain'
  • Choose a icon if you desire


  • Click 'Finish'

  • Three new files get added at the top of the project source package 'org.mymodule.nbmoduledemo'


  • '' is the file which determines the GUI of our plugin. Switch to the design view


  • Add a 'Label', 'Combo box' and a 'Button' thus:


  • The plugin is now ready

Loading the plug-in module into NetBeans

  • Right-click on the module project and choose 'Install/Reload in Target Platform' (6.5: hit F6 (run) first)


  • A new instance of NetBeans starts and you can see the new 'tab'


End Notes

This article has shown you how easily it is to extend NetBeans via writing a plug-in module. The complete project is available for download here. For more tutorials, documentation please refer the links in the documentation section.



Please write to Amit Kumar Saha <>


Thanks Rohan for telling me about 'WindowComponent'

Further reading: -- how to create an action basically a modules home

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo