Class palette.PaletteScale
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:
1.0 02-17-97
Author:
Daren Stotler
See Also:
PaletteServer, PaletteTest, preferredSize

Constructor Index

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

Method Index

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

Constructors

 o PaletteScale
  public PaletteScale(IndexColorModel pal,
                      int w,
                      int h,
                      String labs[])
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

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 preferredSize
  public Dimension preferredSize()
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:
preferredSize in class Component
 o minimumSize
  public Dimension minimumSize()
Allegedly provides a minimum Dimension, but not sure when this is ever called.
Returns:
"minimum" Dimension of the scale
Overrides:
minimumSize in class Component

All Packages  Class Hierarchy  This Package  Previous  Next  Index