Browse Prior Art Database

A Java* layout manager with variable column widths and/or variable row heights

IP.com Disclosure Number: IPCOM000015049D
Original Publication Date: 2001-Nov-16
Included in the Prior Art Database: 2003-Jun-20
Document File: 8 page(s) / 82K

Publishing Venue

IBM

Abstract

The normal Java* Awt layout managers give the ability to layout components in a frame or panel. The most common layout managers are Grid and GridBag. These have drawbacks when trying to render components and maintain a consistent size/look and feel of components as the aspect ratio of the window or frame changes. Therefore a new layout manager is needed that maintains the aspect of the components as the owning frame is re-sized. This Layout manager allows for variable column widths and/or variable row heights (Grd layout for example makes all components the same size), it re-calculates the bounding dimensions of the components that requested variable width or height, but not those that did not. A new algorithm is implemented and a new Java Layout manager is created. This layout manager can be used, for example, in an administration application. The programming style is exactly the same as that used for the Awt Grid layout manager except that this layout manager will not make all components the same size. See following screen shots. An example of the screen layout of the Administration window using the standard Grid layout manager:

This text was extracted from a PDF file.
At least one non-text object (such as an image or picture) has been suppressed.
This is the abbreviated version, containing approximately 41% of the total text.

Page 1 of 8

A Java* layout manager with variable column widths and/or variable row heights

The normal Java* Awt layout managers give the ability to layout
components in a frame or panel. The most common layout managers
are Grid and GridBag. These have drawbacks when trying to render
components and maintain a consistent size/look and feel of
components as the aspect ratio of the window or frame changes.

     Therefore a new layout manager is needed that maintains the
aspect of the components as the owning frame is re-sized. This
Layout manager allows for variable column widths and/or variable
row heights (Grd layout for example makes all components the same
size), it re-calculates the bounding dimensions of the components
that requested variable width or height, but not those that did
not.

     A new algorithm is implemented and a new Java Layout manager
is created. This layout manager can be used, for example, in an
administration application. The programming style is exactly the
same as that used for the Awt Grid layout manager except that
this layout manager will not make all components the same size.
See following screen shots.

     An example of the screen layout of the Administration window
using the
standard Grid layout manager:

1

Page 2 of 8

An example of the screen layout of Administration window using
the
new layout manager (FloatGrid option):

2

[This page contains 37 pictures or other non-text objects]

Page 3 of 8

     From the preceding screen shot you will notice that the
components are in columns and the columns have variable widths.

     Following is a screen shot example showing variable column
widths and variable row heights,

     The layout method in the following example allows for three
different styles of layout from the same layout manager:

3

[This page contains 5 pictures or other non-text objects]

Page 4 of 8

FixedGrid - this performs exactly as the Grid layout and is
functionally compatible
FloatGrid - this allows for variable column widths and row
heights
FloatXYWH - this allows the (x,y) position to be specified as
well as the width and height of the component

   public Dimension layoutContainer( Container container,
boolean preferred,
boolean setBounds )
{ /*
*/

    synchronized ( container.getTreeLock( ) ) /* one at a time
*/

      { /*
*/

      intr=0; /* work variable
*/

      intc=0; /* work variable
*/

      intx=0; /* work variable
*/

      inty=0; /* work variable
*/

      int ncomponents = container.getComponentCount(); /* number of componens
*/

      Insets insets = container.getInsets( ); /* get any insets
*/

      Dimension size = container.getSize ( ); /* get size
*/

/*

*/

      /* make all columns the same width and rows the same height
*/

/*

*/

      if ( mode == Layout_FixedGrid ) /* want re-size ?
*/

        { /* ... yes
*/

        if ( cols <= 0 ) /* any columns
*/

          cols = ncomponents; /* ... no, there is now
*/

        if ( cols > 0 ) /* any columns
*/

          rows = (ncomponents + (cols - 1)) / cols; /* ... yes
*/

        if ( ! setBounds ) /* setting component size ?
*/

          { /* ... no, just get size
*/

          intw=0; /*max width
*/

inth=0; /*max height
*/

          for(inti=0;i< ncomponents;i=i+1) /...