Registering MigLayout in NetBeans IDE 6.7

I started creating a small module that integrates MigLayout into the IDE. That won't help Groovy developers at all, since the GUI Builder generates Java code (and that is unlikely to change). However, it will help Java developers who want to use MigLayout as their LayoutManager.

Already a couple of things are possible—when you create a Swing container in the Matisse GUI Builder, you can set MigLayout as your LayoutManager:

You'll find you have a new node for the layout you chose:

Then you'll also find the MigLayout JAR in the application's Libraries node, which indicates that it has been put on your classpath. In addition, the "initComponents" of a JFrame now has this content:

private void initComponents() {

    getContentPane().setLayout(new net.miginfocom.swing.MigLayout());


If you add a JPanel, the "initComponents" ends up like this:

 private void initComponents() {

    jPanel1 = new javax.swing.JPanel();
    getContentPane().setLayout(new net.miginfocom.swing.MigLayout());

    jPanel1.setLayout(new net.miginfocom.swing.MigLayout());


You can tweak the Options window to not have the FQN generated. It's early days yet, so you can't add the MigLayout constraints yet (e.g., "wrap" and so on). Plus, the above are blue blocks, so you can't even add those constraints manually at this point. Also, the typical Matisse GUI Builder features such as align and resize and so on are not supported. All that's currently available is the registration of the MigLayout library and the ability to graphically add it to your project, together with code generation for setting the LayoutManager via the same graphical function.

The source code can be found here on Kenai:

If you have ideas about how the user should be able to graphically set MigLayout constraints, probably via drag-and-drop, I guess, feel free to join the project and share your ideas.


with netbeans 7 and the source code (don't know if a plugin is directly available), i get: Cannot load component class net.miginfocom.swing.MigLayout from IDE library: MigLayout. The class must be compiled and must be on the classpath of the project to which fhis form belongs.

Posted by collinm on May 26, 2011 at 06:50 PM PDT #

You don't actually tell us how to add this layout manager.

Posted by guest on October 29, 2011 at 09:32 PM PDT #

Please expand/update this article :)

Posted by guest on September 21, 2012 at 07:10 AM PDT #

How to add MigLayout component in NetBeans7.2 IDE??

Posted by guest on January 02, 2013 at 03:29 AM PST #

Steps to use module:

1.) Check out SVN repository from

2.) Add the Utilities API to the list of module dependencies:
- Open module project within Netbeans.
- Right click on project -> properties -> Categories: Libraries -> Module Dependencies -> Add Utilities API

3.) In, change "LayoutSupportRegistry.registerSupportForLayout(MigLayout.class, MigLayoutSupport.class);" to "LayoutSupportRegistry.registerSupportForLayout(MigLayout.class.getName(), MigLayoutSupport.class.getName());"

4.) Clean and build project.

5.) Right click, select Create NBM

6.) In IDE menubar, select Tools->Plugins->Downloaded->Add Plugins
- Browse to module directory. Select build directory. Find .nbm file and select it. Click Open.

7.) Continue the registration process.

Posted by Michael Cress on February 04, 2016 at 06:47 PM PST #

Post a Comment:
  • HTML Syntax: NOT allowed

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.


« June 2016