ColorChart

The ColorChart can be used as a simple color chart in the selection of colors for a NetCharts chart.
It reads colors in the from source HTML file or can be passed a comma delimited list of colors under program control.
It then displays those colors as a table of color "cells" allowing the user to see each color.
For a complete example, see ColorChart1.

As the mouse moves over each box in the color grid, the name or value of the color is displayed in a popup label. If you click the mouse inside a cell, the entire applet will be drawn with that color for as long as the mouse button is depressed. This allows users to see how the color will look when it is used to fill a large area.

Color S0


The following applet parameters are supported by the Color Chart:

ColorTable

NumColumns

Back to Top

 

ColorTable

       <param name=ColorTable value="color1, color2, ...">

The ColorTable applet parameter can be used to define the list of colors to be displayed in the color chart. It accepts a comma delimited list of NetCharts color values (in the form "xRRGGBB") or color names (e.g. "white").

Back to Top

 

NumColumns

       <param name=NumColumns value=number>

The NumColumns applet parameter can be used to define the total number of columns desired. The number of rows will be automatically computed to show all colors.

Back to Top

 

Applet Example

The following applet tag defines a small color chart:

 	<applet name=colorchart
 		code=NFColorChartApp
 		width=400 height=400>

 	<param name=NumColumns value=4>

 	<param name=ColorTable value='
 		white, black, red, green,
 		xEFEFEF, x808080, purple, orange
 	'>
 	</applet>

Back to Top

 

Embedded Applet Support

The Color Chart applet also includes functionality for developers that wish to embed the color applet within their applications. The addObserver() method allows them to be notified when an item has been selected. Parameters like "showFillWhenSelected" and "numColumns" are public, allowing for easy modification. Popup labels and regions can also be defined.

See NFColorChartApp for more details.

Back to Top

 

Embedded Example

       public class AColorApp extends Applet {
           NFColorChartApp colorapp;

           public void init() {
                colorapp = new NFColorChartApp();
                colorapp.numColumns = 4;
                colorapp.setColorTable ("red, white, blue, green");
                colorapp.init((Component)this);

                setLayout(new BorderLayout());
                add("Center", colorapp);
            )
         )


            

Back to Top

 

Known Bugs

When running under Netscape3.x/Win95, with only 256 colors set, this applet may not always display the proper color in the full screen when a color cell is selected. This problem does not exist for any other JVM or browser on Windows 95 or 98.