BoxBeans

JavaBeans for BoxLayout Visualization

News


Introduction

Swing's BoxLayout is a fairly useful layout manager, but using it in a visual environment such as VisualAge for Java's Visual Composition Editor isn't easy.

There are several problems to face:

This became frustrating while teaching, so I developed the Box Beans.   The box beans provide visual support for easy use of BoxLayout.

The following beans are provided:

The struts have a "pixels" property that controls how much space they take up.  Glue doesn't need it, as it expands and collapses as needed.

All of the above beans have a design representation.  That is, when used in a bean builder, they will paint an image to easily identify themselves.  When used at runtime, no image will be painted.  For example:

sample1.gif (9931 bytes)

Note that the struts and Glue have minimum sizes that are > 0 when designing with them.  This ensures that they are visible at design time, and may cause the layout to look slightly different when the bean is actually run.

BoxAdapter in particular would normally be (0,0) when empty.   However, to help visual design I set it up to (20,20) when empty at design time.   That way you can just drop another bean right on top of it without using the Beans List.

Distribution

I have just packaged these as a "feature" for VisualAge for Java 2.0.  I will set up a standard jar file later for use in other (inferior ;) ) environments.

Installation for VisualAge for Java - Feature Packaging

To use the Box Beans in VisualAge for Java:

  1. Download box-vaj.zip from this site.
  2. Unzip box.zip to the directory where VisualAge for Java is installed.  For example, C:\IBMVJava.
  3. Start VisualAge for Java.
  4. Select "Quick Start" from the "File" menu.
  5. Select "Add feature" from the "Features" category.
  6. Select "Javadude Box Beans" to install the box beans.

This will add the box beans to both the AWT and Swing palettes, with the following icons:

If anyone has some better icon images, please let me know and I'll include them!

Installation for Other IDES - Standard JAR File

A standard JavaBean JAR file exists at boxbeans.jar.   I've tested this under JBuilder and it seems to work ok.

Use

VisualAge for Java

To use the Box Beans (once they are installed)

Other IDEs or BeanBox

Setup and use depends on the IDE in question.  As I test against other IDEs I will post usage instructions.

In JBuilder, you can add the jar file to the palette and use it the same way as in VisualAge for Java.

License

Box Beans are free for any use other than selling them as a stand-alone product.

Note that these beans are provided "as-is" without any warrantee or guarantee of suitability for any purpose. Scott Stanchfield cannot be held responsible for any damage caused by use of these beans.

(In other words, use 'em for free at your own risk.)