All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class palette.PaletteScale

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Canvas
                   |
                   +----palette.PaletteScale

public class PaletteScale
extends Canvas
This class draws a Canvas-subclass component which graphically relates an IndexColorModel with its index values. This class was initially intended to be used with just the paletteServer class, but later implementation of that with the IndexColorModel allowed this class to be generalized.

Version:
$Revision: 1.2 $, $Date: 1999/11/19 21:36:46 $.
Author:
Daren Stotler
See Also:
PaletteServer, PaletteTest, preferredSize

Constructor Index

 o PaletteScale(IndexColorModel, int, int, String[], Font)
Lone constructor for the class.

Method Index

 o getMinimumSize()
Allegedly provides a minimum Dimension, but not sure when this is ever called.
 o getPreferredSize()
This is the preferred size based on the initial height and width used in the constructor, plus the font and tick sizes.
 o paint(Graphics)
Lone paint method for the class.

Constructors

 o PaletteScale
 public PaletteScale(IndexColorModel pal,
                     int w,
                     int h,
                     String labs[],
                     Font font)
Lone constructor for the class. The scale is automatically oriented so that the scale runs along and is labeled on its longer axis.

Parameters:
pal - IndexColorModel being used to paint the scale
w - width of the image part of the scale (plus outline)
h - height of the image; if needed, the preferredSize method provides the total size
labs - String array with labs[0] being the overall label, and labs[1 -> N] being the individual tick mark labels; the scale will consist of N equal pieces
font - font to be used for string

Methods

 o paint
 public void paint(Graphics g)
Lone paint method for the class.

Parameters:
g - graphics context in which the scale will be drawn
Overrides:
paint in class Canvas
 o getPreferredSize
 public Dimension getPreferredSize()
This is the preferred size based on the initial height and width used in the constructor, plus the font and tick sizes.

Returns:
Dimension of palette scale
Overrides:
getPreferredSize in class Component
 o getMinimumSize
 public Dimension getMinimumSize()
Allegedly provides a minimum Dimension, but not sure when this is ever called.

Returns:
"minimum" Dimension of the scale
Overrides:
getMinimumSize in class Component

All Packages  Class Hierarchy  This Package  Previous  Next  Index