Download Download

Legend Bean

Version 1.0
Stand: 04.05.2000
Status: Draft

1. Licence

The package openfuture.legend and all its sub-packages and extensions is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the

Free Software Foundation, Inc.,
59 Temple Place,
Suite 330, Boston,
MA 02111-1307

Or visit

Goto Start

2. Description

2.1. Objectives

The OpenFuture component JLegend provides a simple legend for business graphics. It was developed to place a legend somewhere in the application. This solves the problem, that several graphic libraries prefer the display of a legend within the same panel as the chart itself. With JLegend you have the freedom to place it anywhere you want.

Additional requirements realised in this bean where:

alignment in columns

Alignment in columns
alignment in rows

Alignment in rows

2.2. Bean properties

The class JLegend was implemented as a subclass of java.awt.Canvas in order to use it with several JDK releases. It is designed as JavaBean with some special properties:

Property Description
colors Array of Colors for the boxes. If not set, default colors are used.
labels Array of Strings for the labels.
orientation Define orientation of the legend:
  • JLabel.ROWS: align labels in rows,
  • JLabel.COLS: align labels in columns.
borderVisible indicate if border of the boxes is drawn or not.

2.3. Test Application

A simple test frame was provided within the package openfuture.legend.test. This frame is embedding an instance of the legend to demonstrate the behavior on size and/or property change.


The widgets on the south side of the frame can be used to demonstrate the above behavior:

Goto Start

3. References

[R1] GNU Lesser General Public License

[R2] Download Sources here.

Author: Markus Giebeler
Last Update: 08.05.2000 - 09:16