net.java.dev.colorchooser
Class Palette
- java.lang.Object
-
- net.java.dev.colorchooser.Palette
-
public abstract class Palette extends java.lang.ObjectModel for a palette that can be painted, and from which colors may be selected. An array of palettes to use may be supplied to a ColorChooser via the setPalettes method.
-
-
Constructor Summary
Constructors Constructor and Description Palette()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method and Description static PalettecreateContinuousPalette(java.lang.String name, java.awt.Dimension size, float saturation)static PalettecreatePredefinedPalette(java.lang.String name, java.awt.Color[] colors, java.lang.String[] names)abstract java.awt.ColorgetColorAt(int x, int y)Returns the color at the specified point, or null if the point is beyond the bounds of the palette or in an area that does not indicate a colorstatic Palette[]getDefaultPalettes(boolean continuousFirst)Get the default set of 8 palettes used by the color chooser.abstract java.lang.StringgetDisplayName()abstract java.lang.StringgetNameAt(int x, int y)Returns a string description of the color at the point.abstract java.awt.DimensiongetSize()Get the on-screen size of this paletteabstract voidpaintTo(java.awt.Graphics g)Paint this palette to a graphics context.abstract voidsetSize(int w, int h)Get a localized name for this palette or null if a display name is not warranted
-
-
-
Method Detail
-
getColorAt
public abstract java.awt.Color getColorAt(int x, int y)Returns the color at the specified point, or null if the point is beyond the bounds of the palette or in an area that does not indicate a color- Parameters:
x- - an horizontal coordinate in the coordinate space of the palettey- - a vertical coordinate in the coordinate space of the palette- Returns:
- - a color or null
-
getNameAt
public abstract java.lang.String getNameAt(int x, int y)Returns a string description of the color at the point. May be a name or a set of RGB values, but should not be longer than 30 characters. Returns null if the position is outside the bounds of the palette or has no description associated with it. Generally getNameAt() should return null from the same coordinates that getColorAt() would.- Parameters:
x- an horizontal coordinate in the coordinate space of the palettey- a vertical coordinate in the coordinate space of the palette- Returns:
- a string describing the color at this coordinate or null
- See Also:
getColorAt(int, int)
-
paintTo
public abstract void paintTo(java.awt.Graphics g)
Paint this palette to a graphics context.- Parameters:
g- - a graphics context to paint into
-
getSize
public abstract java.awt.Dimension getSize()
Get the on-screen size of this palette- Returns:
- the size of this palette - corresponding to the screen space required to display it and defining the coordinate space of this palette.
-
setSize
public abstract void setSize(int w, int h)Get a localized name for this palette or null if a display name is not warranted
-
getDisplayName
public abstract java.lang.String getDisplayName()
-
getDefaultPalettes
public static final Palette[] getDefaultPalettes(boolean continuousFirst)
Get the default set of 8 palettes used by the color chooser. If continuousFirst is true, the first four will be continuous palettes and the second four swatches with named colors, system colors, etc.
-
createContinuousPalette
public static final Palette createContinuousPalette(java.lang.String name, java.awt.Dimension size, float saturation)
-
createPredefinedPalette
public static final Palette createPredefinedPalette(java.lang.String name, java.awt.Color[] colors, java.lang.String[] names)
-
-
DMelt 3.0 © DataMelt by jWork.ORG