|Components in the Layout||Table of Possible Layout Managers|
|What Layout Managers Do||Gotchas|
|Null Layouts||Learning More|
These methods often return 0,0 as the size. The reason is, they rely on the underlying GUI (Graphic User Interface) to compute the size and if there in no peer object yet, there is no hook to ask the native GUI. See addNotify.
You should almost never use null layouts and setLocation. This is a last ditch emergency method when all layout managers have failed to give you decent positioning and it would be impossible to write a layout manager with enough common sense.
When you do use manual layout you must do several things:
|Possible Layout Managers|
|AbsoluteLayout||Netbeans absolute position layout.|
Place components on a simple north, south, east, west, center grid.
Oracle’s Javadoc on BorderLayout class : available:
Place components in a single row or column. Designed to work with glue and
strut objects of the Box class to control where
extra space goes. Aligns based on the
properties of the JComponents in the Container. To control alignment use
( 0.0F ) for left aligned, setAlignmentX( .5F ) for
centered and setAlignmentX( 1.0F ) for right aligned. Only available in Swing.
Oracle’s Javadoc on BoxLayout class : available:
Allows you to flip through several panels, where only one is visible at a
Oracle’s Javadoc on CardLayout class : available:
|DesignGridLayout||Uses Patrizia Nanni’s canonical grids.|
|EasyLayout||Stripped down GridBagLayout. Has just weights and grid numbers.|
|ExplicitLayout||Allows non-rectangular layouts. By Zooki Technology.|
|FillLayout||SWT (Standard Widget Toolkit). lays out equal-sized widgets in a single row or column.|
Simple flow left to right, top to bottom stream of components. This is a very
rough and ready, quick and dirty layout for prototypes. If you want fine
control and professional looks, try another.
Oracle’s Javadoc on FlowLayout class : available:
|FormLayout||Karsten Lentzsch’s free, open source LayoutManager. Karsten is the Leonardo da Vinci of layout designers. His layouts get every last picky detail correct, including working with larger-than-expected fonts. Even if you don’t use his layouts, read what he has to say about GUI design. version 1.2 is coming soon which has layout variables for meta design constants. Last revised/verified: 2008-04-04 For example, 85dlu for all label column widths, 100dlu for the minimum table height, etc. See scalable layouts for a discussion of the problem of scaling layouts.|
|GridBagLayout||Oracle’s mother of all layout managers. It is complicated and powerful. To cover it requires a separate entry. Place components on a rough n x m grid. Some components may take up multiple cells. Fine tuning of whitespace around each component and alignment of each component within its grid cell. Requires a lot of tweaking to make it look right. The cells are not necessarily the same size. They adjust to fit the components, based on various hints you give.|
Layout components in a regular n × m grid. All cells are the same width
and height. |
Oracle’s Javadoc on GridLayout class : available:
|GridLayout SWT||SWT. lays out widgets in a grid FormLayout|
|GroupLayout||Part of Netbeans/Matisse. It is not bundled with the JDK (Java Development Kit). It backs up the visual layout abilities of Matisse.|
|HIGLayout||Similar to TableLayout, by Daniel Michelik|
|JTabbedPane||JTabbedPane is a JComponent, not a LayoutManager, but it behaves much like a CardLayout with tabs.|
|JSplitPane||JSplitPane is a JComponent, not a Layout, but it behaves much like one with two panels and a moveable boundary between them.|
|LabeledGridBagLayout||Like a GridBagLayout that automatically labels fields with their corresponding field names. Requires use of smart components that know their field labels. Part of the com.mindprod.business package.|
|Matisse: aka Gui Builder||A new NetBeans scheme for building layouts interactively with a backing set of layout managers. It is still in alpha test.|
|MigLayout||Free. Intended to be a universal layout manager for all possible applications. This is RedGrittyBrick’s favourite layout manager. Has tools for writing resolution-independent code.|
|Packer||A front end to the GridBagLayout using a fluent interface to cut down the number of positional parameters. Not to be confused with PackerLayout.|
|PackerLayout||A Java version of the Tcl/Tk layout manager. Some of the GridBag pad/expand abilities.|
|RowLayout||SWT. lays out widgets in a row or rows, with fill, wrap and spacing options.|
|fuin.org ScalableLayout||Zoom the Swing UI (User Interface) (like CTRL+/CTRL- in Firefox for web pages)|
a model of structs and springs to control the sizes and positions of boxes.
Only available in Swing.
Oracle’s Javadoc on SpringLayout class : available:
|StarLayout||Arranges objects in star shaped patterns. You place components by giving the angle and radius from the centre of the container.|
|TableLayout||A simplified GridBagLayout. You explicitly control the relative sizes of each row and column. By Daniel Barbalace and the ClearThought TableLayout Project.|
|XYLayout||Borland absolute position layout.|
NetBeans and JBuilder have GUI layout builders. Radical is a stand-alone GUI Builder.
This page is posted
Optional Replicator mirror
Your face IP:[220.127.116.11]
You are visitor number|