Download NetBeans!

20081203 Wednesday December 03, 2008

Creating a NetBeans Platform Toolbar in 6.5

Creating a new toolbar for NetBeans IDE is now easy in 6.5. Just use the New Action wizard, which gives you an "ActionListener", and then replace the "ActionListener" implementation with a "Presenter.Toolbar", as shown here:

package org.demo.toolbar;

import java.awt.Component;
import org.openide.util.actions.Presenter;

public final class SomeAction implements Presenter.Toolbar {

    //Here's where you put your panel into the toolbar area:
    @Override
    public Component getToolbarPresenter() {
        return new DemoJPanel();
    }

}

Finally, delete the "instanceCreate" attribute that the New Action wizard created in the layer.xml. Then install and you're done.

Update. See this tutorial for the complete example, the above is partial and incomplete.

Dec 03 2008, 06:42:06 AM PST Permalink

Trackback URL: http://blogs.sun.com/geertjan/entry/creating_a_netbeans_platform_toolbar
Comments:

Thanks for your post. It worked fine.
I have one question: let's say you clicked "New Action", and then you forgot to select the checkbox "Global toolbar button"... at the end of the coding of the class "SomeAction", you start the project and you notice that you forgot to put an instance of "SomeAction" in the toolbar menu. In this case, what do you do ? Do you have to edit the layout.xml file or is there another possibility ?

Posted by RunningTracker on December 07, 2008 at 03:04 AM PST #

thank u. nice work.

Posted by sinema izle on March 10, 2009 at 02:22 PM PDT #

I do not understand what is meant with "install". Can someone explain it to me step by step?

Posted by 217.24.204.7 on May 25, 2009 at 10:07 AM PDT #

Right click and choose Run.

Posted by Geertjan on May 25, 2009 at 10:30 AM PDT #

Post a Comment:

Name:
E-Mail:
URL:

Your Comment:

HTML Syntax: NOT allowed