java calendar component
Top25 RFE



MigLayout - Java Layout Manager

for Swing, SWT and JavaFX

"MiG Layout makes complex layouts easy and normal layouts zero-liners."



Mig Layout Quick Start PDF

View this PDF for a Fast Start!


  MigLayout - Easy to use yet very powerful Java Swing, JavaFX and SWT layout manager

For Java developers writing GUI layouts by hand that wants simplicity, power and automatic per platform fidelity, that are dissatisfied with the current layout managers in Swing, JavaFX and SWT, MigLayout solves your layout problems. User interfaces created with MigLayout is easy to maintain, you will understand how the layout will look like just by looking at the source code.

MigLayout is a superbly versatile SWT/Swing/JavaFX layout manager that makes layout problems trivial. It is using String or API type-checked constraints to format the layout. MigLayout can produce flowing, grid based, absolute (with links), grouped and docking layouts. You will never have to switch to another layout manager ever again! MigLayout is created to be to manually coded layouts what Matisse/GroupLayout is to IDE supported visual layouts.


  MigLayout for other toolkits, e.g. Android and Fantom

MigLayout's layout engine is written in pure Java, with no dependencies on Swing or any other UI toolkit. The Swing and SWT versions are the ones developed by MiG InfoCom AB, but you are free to write the glue code to make it work for other toolkits as well.

There is an IntelliJ plugin to verify the MigLayout string constaints created by Kevin Peck. Read this Forum Post for more information and bug reports.

There is also MigLayout for Scala, Groovy, Fantom, Android and Delphi among others, and more are coming. Use your favorite search engine for now, but they will be linked from here soon.

If you want to create a version of MigLayout for another toolkit let us know and we'll link to if from here. To start with you can read Porting to other frameworks (PDF)


  MigLayout is Free and Open Source

MigLayout is free to use for commercial and non-commercial projects and the source code is provided. It is licensed under the very free BSD or GPL license, whichever you prefer. We would be glad if you told us about where it is used though. Please spread the word if you like MiGLayout! Likewise we welcome bug reports and feedback at our forums under the MigLayout section. It will lead to improvements, we promise. As with all MiG Products we have a Zero Bugs Policy!Support This Project


  MigLayout Downloads

Downloads Folder (v4.0 released on 2011-08-11. 4.2 is in the Maven repo.) Change Log

v4.2 is in Maven repo, please go to the MigLayout Maven Site.

v5.0 is in the Sonatype repo, please go to the Sonatype Site.

Git access through google code:

Quick Start Guide: (PDF). Cheat Sheet: (PDF / HTML). White Paper: (HTML). API JavaDoc: (HTML)

MigLayout works with: Sun Java 5.0+, IBM Java 1.5+, Excelsior JET Ahead of Time Compiler


  Demo Applications with Source Code for Swing and SWT

Demo applications are included in the download.


  Using the MigLayout Demos for GUI Benchmarking

The demo applications can be used for GUI benchmarking. You can for instance measure the difference between SWT and Swing or how the different versions of Java measure up. You can even set another Look&Feel for the Swing version and measure the speed of the widget creation and rendering.

To run the demos in benchmarking mode you have to download the .jar(s) from above. Note that you need the .dll to be in the current directory when running the SWT version. It is not needed for the Swing version.

Run the .jar with "java -jar swingdemoapp.jar -help" or "java -jar swtdemoapp.jar -help" and the usage and examples are shown.

If you want to run the SWT benchmark under Linux or OS X you will need the swtdemoappbase.jar as well as the correct swt.jar and any required native libraries. They are provided on the eclipse site.


  Getting Started with MigLayout

It is really simple to get started with MigLayout. All you need to do is to download the correct .jar from above and add it to you classpath. That's it!

You should read the white paper linked above. It contains all you need to know. You might also want to look at the source code for for the demo applications. In the Swing version of the demo application you can right-click any component or container and change the constraints. It is a good way to learn by trial-and-error.

Printing the Cheat Sheet is a good idea since it gives you all the keywords in a short and simple list.

To give you an idea about how the layout manager works, below is the source code for the Quick Start panel. Note that all gaps (white space) is added automatically. The gaps will be correct for the platform it is run. Even the white space around the components (border) is automatic!

    JPanel panel = new JPanel(new MigLayout());

    panel.add(lastNameLabel,       "gap unrelated");
    panel.add(lastNameTextField,   "wrap");
    panel.add(addressTextField,    "span, grow");


That code produces this panel:

mig layout quickstart panel


  Support and Help

You can post questions and comments at our forums under the MiG Layout section.

You can find more components from MiG InfoCom at the MiG Components and MiG Java Calendar sites.


© 2011 MiG InfoCom AB