| example.chooser.ColorChooser
ColorChooser | public class ColorChooser extends Canvas (Code) | | A Color chooser. This screen can be used to display and
choose colors. The current color is always available
via the getColor and getGrayScale methods. It can be
set with setColor.
A palette provides some reuse of colors, the current
index in the palette can get set and retrieved.
When the chooser is active the user may set the index
in the palette, and change the red, green, and blue
components.
The application using the chooser must add commands
to the chooser as appropriate to terminate selection
and to change to other screens.
The chooser adapts to the available screen size
and font sizes.
|
Field Summary | |
final static int | BORDER |
Method Summary | |
public int | getBlueComponent() Gets the blue component of the current color. | public int | getColor() Gets the current color. | public int | getDelta() Get the delta used to increment/decrement. | public int | getGrayScale() | public int | getGreenComponent() Gets the green component of the current color. | public int | getPaletteIndex() Get the current palette index. | public int | getRadix() Get the radix used to display numbers. | public int | getRedComponent() Gets the red component of the current color. | protected void | keyPressed(int key) | public void | keyRepeated(int key) | protected void | paint(Graphics g) | public void | setColor(int red, int green, int blue) Sets the current color to the specified RGB values. | public void | setColor(int RGB) Sets the current color to the specified RGB values. | public void | setDelta(int delta) Set the delta used to increment/decrement. | public void | setGrayScale(int value) Sets the current grayscale. | public boolean | setPaletteIndex(int index) Select which entry in the Palette to use for the current color. | public void | setRadix(int rad) Set the radix used to display numbers. | protected void | showNotify() The canvas is being displayed. |
BORDER | final static int BORDER(Code) | | |
ColorChooser | public ColorChooser(boolean isColor)(Code) | | |
getDelta | public int getDelta()(Code) | | Get the delta used to increment/decrement.
|
getGrayScale | public int getGrayScale()(Code) | | |
getPaletteIndex | public int getPaletteIndex()(Code) | | Get the current palette index.
the current index in the palette. |
getRadix | public int getRadix()(Code) | | Get the radix used to display numbers.
|
keyPressed | protected void keyPressed(int key)(Code) | | |
keyRepeated | public void keyRepeated(int key)(Code) | | |
paint | protected void paint(Graphics g)(Code) | | |
setColor | public void setColor(int red, int green, int blue)(Code) | | Sets the current color to the specified RGB values.
Parameters: red - The red component of the color being set in range 0-255. Parameters: green - The green component of the color being set in range 0-255. Parameters: blue - The blue component of the color being set in range 0-255. |
setColor | public void setColor(int RGB)(Code) | | Sets the current color to the specified RGB values. All subsequent
rendering operations will use this specified color. The RGB value
passed in is interpreted with the least significant eight bits
giving the blue component, the next eight more significant bits
giving the green component, and the next eight more significant
bits giving the red component. That is to say, the color component
is specified like 0x00RRGGBB.
Parameters: RGB - The color being set. |
setDelta | public void setDelta(int delta)(Code) | | Set the delta used to increment/decrement.
The default is 32.
|
setGrayScale | public void setGrayScale(int value)(Code) | | Sets the current grayscale.
For color the value is used to set each component.
Parameters: value - the value in range 0-255 |
setPaletteIndex | public boolean setPaletteIndex(int index)(Code) | | Select which entry in the Palette to use for the current color.
Parameters: index - index into the palette; 0..10. |
setRadix | public void setRadix(int rad)(Code) | | Set the radix used to display numbers.
The default is decimal (10).
|
showNotify | protected void showNotify()(Code) | | The canvas is being displayed. Compute the
relative placement of items the depend on the screen size.
|
|
|