NetBeans Plugin – A new start !

After the NetBeans Certified Training, I have decided to make a small plugin just to test it it works perfectly or not and it is working awesome. 😀 Netbeans have a modular architecture that permits plug and unplug functionalities easily using the Plugin Manager.

It’s also easy create new plugins using Netbeans itself. The steps which I performed while making a plugin are as follows:

Create a New Project clicking in File → New Project.


In Categories select Netbeans Module and in Projects select Module.


Click in Next.

In the next screen you can choose your module name, like HelloTweeps. Leave the rest with the default values.


Now you have to set up the package base name, something like in.myin.HelloTweeps.


Now you have an empty module, but we need some action.

Then, Right click in your source package and click in New → Action.


Now we’ll fill another wizard. The first screen is about Action Type. Leave all with the default values (the Always Enabled option) and click Next.


In the GUI Registration screen, We can set where we want our action appears as an menu item. We chose Menu as  file and select Global Toolbar Button. In Toolbar select Run and in Position select Profile Main Project…- HERE. Click Next.


Now we will set up the screen Name, Icon and Location. In Class Name we choose HelloAction. Display Name is how the class will appear in the menu, so we can spaces. You should select an icon in dimensions of 16×16. In the same directory you can put to an icon in 24×24. If your 16×16 icon is named smile.png your 24×24 icon should be smile24.png. Doesn’t matter where is this icon, it’ll be automatically copied to the module directory. Now click Finish.


After clicked in Finish your project will look like that:


At this point we can already test our module! For doing that right click in Puzzle HelloTweeps(puzzle icon) and selectInstall/Reload in Target Platform. This will open a new instance of Netbeans with your module installed!

If everything goes alright you will see your icon in the toolbar.


Oh…yeah! We have got a plugin 😀 But if you click in the smile nothing happens. We have defined no action at all.

A module can have dependencies from others modules. When you try to install it, Netbeans will ask about install their modules dependencies. We can see and set up the dependencies in our module properties screen. You can right click PuzzleHelloTweeps and go in Properties. Another way to do the same is going in File → “HelloTweeps” Properties.


In the Project Properties screen select Libraries in the left side, Categories. There are listed the Java, Netbeans and all Module Dependencies of your module. By default you’ll see UI Utilities API and Utilities API module dependencies.

Click in the button Add (that one near the module dependencies). You’ll see the Add Module Dependency screen where are listed all Netbeans modules.

We want add an dependency for the Dialogs API. Type “dialogs” in the filter text field.


Select the module Dialogs API and click OK. Now our module have two dependencies: Utilities API and Dialogs API.


Now for the first time, let’s right some code. Coding time!! 😀

In HelloAction.java file , there’s a class HelloAction. In the method performAction() there’s nothing but:

//TODO implement action body

We will rewrite the performAction method:

To test your module, do it again:  PuzzleHelloTweeps → Install/Reload in Target Platform. A new instance of Netbeans will open and you’ll see our smile face button again. When you click it, Netbeans will show an dialog.


Let’s do more. Let’s talk with the Tweep using NotifyDescriptor.InputLine. Will create an input line dialog, get the user name (if he clicks in Ok) and display a message to him.

Again, PuzzleHelloTweeps→ Install/Reload in Target Platform.

After the new Netbeans instance opens, click in our smile face.

That’s it. You made your Netbeans plugin! Now, I will try to build a plugin which will try to show the recent changes inside the NetBeans soon.Till then,

Enjoy 😀

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s