public class ColorMapper
extends java.lang.Object
Color
) into a fixed width font which can be
used to display that text in a CHUI which uses that color specification.
At this time, only the attributes member of a color specification is honored. The color member is not supported.
The BLINK
attribute cannot be supported directly with a font
alone (all other attributes can be duplicated with a single font). Instead
the calling code will have to use a timer to periodically redraw the font
while inverting the colors each time.
Modifier and Type | Field and Description |
---|---|
private java.util.Map<Color,java.awt.Font> |
map
Cache of fonts mapped to the color instances they represent.
|
Constructor and Description |
---|
ColorMapper(java.awt.Font font)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
reset(java.awt.Font font)
Reset the cache based on the given font.
|
static java.awt.Color |
toColor(ColorPalette clr)
Convert the given 4GL color definition into an AWT color instance.
|
java.awt.Font |
toFont(Color color)
Derive a font from
Color.NORMAL which has the attributes
specified in the given color. |
java.awt.Font |
toFontReverse(Color color)
Derive a font from
Color.NORMAL which has the attributes
specified in the given color AND then return the reverse of that font. |
private java.util.Map<Color,java.awt.Font> map
public ColorMapper(java.awt.Font font)
font
- The base font which defines Color.NORMAL
and from
which all other "colors" are derived.public void reset(java.awt.Font font)
font
- The base font which defines Color.NORMAL
and from
which all other "colors" are derived.public java.awt.Font toFontReverse(Color color)
Color.NORMAL
which has the attributes
specified in the given color AND then return the reverse of that font.
parameter is not honored, only the attribute member is handled.
BLINK
is not supported at this time.
color
- The color specification to convert into a font.public java.awt.Font toFont(Color color)
Color.NORMAL
which has the attributes
specified in the given color. If that font has already been derived, it
will be returned from a cache. At this time, the color member of the
parameter is not honored, only the attribute member is handled.
BLINK
is not supported at this time.
color
- The color specification to convert into a font.public static java.awt.Color toColor(ColorPalette clr)
clr
- The 4GL color definition.