FaqFormNoSwingLayout
Can I design my GUI without using the swing-layout library?
Yes.
Though the "free design" mode requiring the swing-layout library is offered by default for newly created forms, you can avoid using it. This means you need to use a standard layout manager for each visual container. Do this only if you need to deploy just with standard JDK classes (for pre-Java 6 version) and if you are willing to configure all the layout managers' settings.
- Whenever you create a new form, set its layout immediately to the desired layout manager:
- right click the form in the designer, go to the Layout menu and choose some layout manager (e.g. GridBagLayout).
- Save, close, and open the form again (or hit Ctrl-R).
- From now the "free design" mode will not be offered for this form, each new container added will have its default layout manager.
To ease this a bit, you can save the form from step 1 as a template and next time create new forms from it:
- Right-click the created file in Projects explorer.
- Choose 'Save As Template...' and then 'Java GUI Forms' category.
- Create new forms as usual via the New wizard - just select your template.
Before you go to distribute the application, test that all your projects don't use the swing-layout library:
- Go to the project properties, Libraries node, and make sure there is no Swing Layout Extensions library (remove it).
- Then clean and build the project.
- If it builds fine, you can be sure it uses just standard JDK classes.
Applies to: NetBeans 5.0, 5.5, 6.0
Platforms: All

