How to use the FormatLayout

A discussion forum for the JCommon class library.
Locked
Virgil

How to use the FormatLayout

Post by Virgil » Wed Jan 30, 2002 5:24 pm

Hi. I downloaded the class library doc and browsed through the javadocs but I can't find some information on how to use the FormatLayout manager. I have no idea what the int[] format in the constructor is.

David Gilbert

RE: How to use the FormatLayout

Post by David Gilbert » Thu Jan 31, 2002 4:39 pm

Hi Virgil,

I went in and rewrote the Javadoc comment for the FormatLayout constructor. I'll cut and paste it here (hopefully it will format OK). The picture in the PDF documentation shows 7 rows, one with each format, to give you an idea of what you might get.

A couple of provisos (1) I wrote this some time ago, and haven't used it much, so it may have bugs (2) I don't know enough about layout managers to know whether I have followed all the rules with this class. But try it out anyway...

/**
* Constructs a new layout manager that can be used to create input forms. The layout manager
* works by arranging components in rows using six columns (some components will be spread
* across more than one column).
* <P>
* Any component can be added, but I think of them in terms of Labels, Components, and Buttons.
* The formats available are: C, LC, LCB, LCLC, LCLCB, LCBLC or LCBLCB.
* <P>
* C - 1 component in this row (spread across all six columns).
* LC - 2 components, a label in the 1st column, and a component using the remaining 5 columns).
* LCB - 3 components, a label in the 1st column, a component spread across the next 4, and a
* button in the last column.
* LCLC - 4 components, a label in column 1, a component in 2-3, a label in 4 and a component
* in 5-6.
* LCLCB - 5 components, a label in column 1, a component in 2-3, a label in 4, a component
* in 5 and a button in 6.
* LCBLC - 5 components, a label in column 1, a component in 2, a button in 3, a label in 4,
* a component in 5-6.
* LCBLCB - 6 components, one in each column.
* <P>
* Columns 1 and 4 expand to accommodate the widest label, and 3 and 6 to accommodate the
* widest button.
* <P>
* Each row will contain the number of components indicated by the format. Be sure to
* specify enough row formats to cover all the components you add to the layout.
*
* @param rowCount The number of rows.
* @param rowFormats The row formats.
*/

Regards,

DG.

Virgil

RE: How to use the FormatLayout

Post by Virgil » Thu Jan 31, 2002 7:59 pm

Thanks for info David.

David Gilbert

RE: How to use the FormatLayout

Post by David Gilbert » Fri Feb 01, 2002 10:03 am

I just spotted the following on Swing Connection:

http://java.sun.com/products/jfc/tsc/ar ... blelayout/

At first look, this layout manager may be a better way of achieving the sorts of layouts I intended with FormatLayout...

Regards,

DG.

Locked