AbsoluteLayout
is a special layout manager provided by the IDE that enables you to
place components exactly where you want them in the form, move them around in the IDE,
and resize them using their selection borders.
AbsoluteLayout is particularly useful for making prototypes. You do not have to enter any property settings and there are no formal limitations within the layout.
![]() |
AbsoluteLayout is not recommended for production applications. The fixed locations
and sizes of components do not change when the environment changes. Therefore,
significant distortions in appearance can occur when such an application is run on a
different platform or when using a different look and feel.
If you design a production application using AbsoluteLayout, consider switching the layout manager to GridBagLayout and then fine-tuning it before you distribute the application. |
Using the AbsoluteLayout manager is similar to using Null Layout, except that AbsoluteLayout uses a layout manager and Null Layout means no layout manager is used at all.
An advantage of using the AbsoluteLayout manager instead of Null Layout is that you don't need to programmatically set the size of the container component in order to keep it from initially displaying at the minimum size. This assumes the container's Form Size Policy (a Code Generation property) is set to the default, Generate pack(). If it is instead set to No Resize Code, the container is displayed at the minimum size regardless of the layout manager, and no components are visible until the user resizes the form.
The source code is also redistributable. It is available in the files AbsoluteLayout.java and AbsoluteConstraints.java, found in <install-dir>/sources/org/netbeans/lib/awtextra.
See also | |
---|---|
Null Layout
GridBagLayout Modifying Code Generation for a Form Setting the Layout Manager |