tags:

views:

36

answers:

2

Is there a table documenting which properties each java layout ignores (max size, min size, etc)?

+1  A: 

You can look for Providing Size and Alignment Hints in :

http://java.sun.com/docs/books/tutorial/uiswing/layout/using.html

The best is to look for the documentation of the Layout you want to use. However, I think there is no table documentation.

Laurent
The documentation of the layout don't say everything. BorderLayout, for example, ignores the maximum size in same cases, and the doc says nothing about it.
Tom Brito
A: 

Lots of these properties are specified in the javadocs for the specific classes. For example, BorderLayouts behavior is specified as:

The components are laid out according to their preferred sizes and the constraints of the container's size. The NORTH and SOUTH components may be stretched horizontally; the EAST and WEST components may be stretched vertically; the CENTER component may stretch both horizontally and vertically to fill any space left over.

And the FlowLayout specifies:

A flow layout lets each component assume its natural (preferred) size.

The GridLayout specifies in the documentation for the constructor:

All components in the layout are given equal size. [However large the grid is]

And BoxLayout states:

BoxLayout attempts to arrange components at their preferred widths (for horizontal layout) or heights (for vertical layout). For a horizontal layout, if not all the components are the same height, BoxLayout attempts to make all the components as high as the highest component. If that's not possible for a particular component, then BoxLayout aligns that component vertically, according to the component's Y alignment. By default, a component has a Y alignment of 0.5, which means that the vertical center of the component should have the same Y coordinate as the vertical centers of other components with 0.5 Y alignment.

Similarly, for a vertical layout, BoxLayout attempts to make all components in the column as wide as the widest component. If that fails, it aligns them horizontally according to their X alignments. For PAGE_AXIS layout, horizontal alignment is done based on the leading edge of the component. In other words, an X alignment value of 0.0 means the left edge of a component if the container's ComponentOrientation is left to right and it means the right edge of the component otherwise.

jjnguy
I would like if there's is a table summarizing this all, but looks like there isn't. Thanks anyway.
Tom Brito
@Tom, it seems like the documentation is really spread out, kinda' sucks.
jjnguy