Browse Prior Art Database

Adding Style to components displayed under control of the awt layout manager

IP.com Disclosure Number: IPCOM000015015D
Original Publication Date: 2001-Sep-16
Included in the Prior Art Database: 2003-Jun-20
Document File: 6 page(s) / 53K

Publishing Venue

IBM

Abstract

Allowing greater control over how components are rendered into a Java* panel using a layout manager by applying a style string to provide additional control over the rendering process: The Style string provides information allowing for: exact placement of the component using the next available position using the component preferred size using the current column width show component using no more than current column width using the row height show component using no more that current row height using the remaining column width (i.e. last component in row) using the remaining row height (i.e. last component in column) This requires a new class/object to hold the rendering style that is held by the layout manager along with the reference to the component that is to be rendered. A new class is created that holds a rendering style string, the class also holds the current calculated value for x, y coordinates and width and height.

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 30% of the total text.

Page 1 of 6

Adding Style to components displayed under control of the awt layout manager

Allowing greater control over how components are rendered into a
Java* panel using a layout manager by applying a style string to
provide additional control over the rendering process:

The Style string provides information allowing for:
exact placement of the component
using the next available position
using the component preferred size
using the current column width
show component using no more than current column width
using the row height
show component using no more that current row height
using the remaining column width (i.e. last component in
row)
using the remaining row height (i.e. last component in
column)

     This requires a new class/object to hold the rendering style
that is held by the layout manager along with the reference to
the component that is to be rendered.

     A new class is created that holds a rendering style string,
the class also holds the current calculated value for x, y
coordinates and width and height.

Styles are a string of the form:

"[nn{,nn{,nn,nn}}]{< | >}"

     [nn] - set width
[nn,nn] - set width and height
[nn,nn,nn,nn] - set x, y, width and height
< - set width to length of text
[nn{,nn}]> - set width to length of text - but not less
than "nn" width

              nn value of -1 means use component preferred size
nn value of -2 means use current row height or
column width
nn value of -3 means use reamaing height as row
height or
remaining width as column width

The "<" and ">" modifiers only work with the following
components:
Button, Checkbox, Label, TextField, TextArea

E.g. a TextField component added to an awt panel using current
column width (but shrink to fit text), and use remaining height
as row height:

1

Page 2 of 6

     panel.add( new java.awt.TextField( "" ), new AwtXY(
"[-2,-3]<" ) );

Example of ouput using the xy style layout manager:

The code for this layout manager is as follows:

/*------------------------------------------------------------------------------*/

/* (C) Copyright IBM Corp. 1999 */
/*------------------------------------------------------------------------------*/

package com.ibm.awt;
import java.awt.*;
/*------------------------------------------------------------------------------*/

/* Class: */
/* */
/* AwtXY */
/* */
/* Extends: */
/* */
/* nothing */
/* */
/* Function: */
/* */
/* hold the x,y,w,h values for a component for AwtLayout */
/* */
/*------------------------------------------------------------------------------*/

public class AwtXY

{
int x = 0; /* x coord */
int y = 0; /* y coord */
int width = 0; /* width */
int height = 0; /* height */
String style = null; /* display style */

/*----------------------------------------------------------------------------*/

/* constructor */
/*----------------------------------------------------------------------------*/

public AwtXY( )

{
}

/*----------------------------------------------------------------------------*/

2

[This page contains 1 picture or other non-text object]

Page 3 of 6

/* constructor - set x,y,w,h */
/*------...