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 handles.
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, switch the layout manager to GridBagLayout and then fine-tune it before you distribute the application. |
When you select AbsoluteLayout, you either use the IDE's special AbsoluteLayout
manager or you use a null layout (no layout manager). If the generated source
code contains setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout())
,
you are using the IDE's special layout manager. If the generated source code contains
setLayout(null)
, you are not using a layout manager.
See Null Layout for information on setting the
property that determines whether AbsoluteLayout or a null layout is used.
An advantage of using the AbsoluteLayout manager instead of a 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.
You can switch the display of a grid on the Form window when using AbsoluteLayout by
clicking the Show Grid button:
netbeans/lib/ext/AbsoluteLayout.jar
. The source code is
also redistributable. It is available in the files AbsoluteLayout.java
and AbsoluteConstraints.java
, found in
netbeans/sources/org/netbeans/lib/awtextra
.
See also | |
---|---|
Null Layout
GridBagLayout Modifying Code Generation for a Form Setting the Layout Manager |