Class PalettePanel

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class PalettePanel extends JPanel
A palette panel displays a color palette graphically as a stripe of colour.
Since:
3.1.6
Author:
Peter Hollemans
See Also:
  • Constructor Details

    • PalettePanel

      public PalettePanel()
      Creates a new palette panel with no initial palette.
    • PalettePanel

      public PalettePanel(Palette palette)
      Creates a new palette panel with the specified initial palette.
  • Method Details

    • paintComponent

      public void paintComponent(Graphics g)
      Overrides:
      paintComponent in class JComponent
    • createImage

      public Image createImage(Dimension dims)
      Creates an image of the palette for the panel. This is made public for use in rendering palette images in other contexts.
      Parameters:
      dims - the dimensions of the image to create.
      Returns:
      the palette image of the specified dimensions.
      Since:
      3.5.1
    • setPalette

      public void setPalette(Palette palette)
      Sets the current palette.
    • setFunction

      public void setFunction(EnhancementFunction func)
      Sets the enhancement function. The enhancement function is used to change the way that the palette is displayed. Normally the palette stripe is displayed as a simple left-to-right set of colors showing the palette colors with index 0 to nColors-1 where nColors is the number of colors in the palette. When an enhancement function is applied, the palette stripe is modified so that stripe reflects how colors would be assigned to data values in a ColorEnhancement view with the specified enhancement and palette. The left end of the stripe shows the color given to the minimum value in the range, the right side the maximum value, and the colors between reflect the shape of the enhancement function. By default the enhancement function is a linear enhancement with range [0..1].
      Parameters:
      func - the enhancement function.
      See Also:
    • setRange

      public void setRange(double[] range)
      Sets the data value range. The range is used in combination with the enhancement function to determine the colors shown in the color stripe. By default the range is determined from the enhancement function itself.
      Parameters:
      range - the data value range as [min, max].