public class IlvBlinkingMultiColor extends Color implements IlvBlinkingDrawingResource
IlvGraphic
support blinking colors.
Limitation: For technical reasons, the period duration is limited from 1 to max integer (not max long). It is recommended to use the same durations whenever possible for all objects, and to choose the durations not too small (e.g. not smaller than 100 ms), because otherwise the performance of the system will degrade dramatically.
Hashing (tables or maps) of a mixture of blinking colors and normal
colors don't work, since the fully transparent white color claims to
be equal to any blinking color (i.e.
transparentWhite.equals(blinkingColor) returns
true).
However, this is no problem if the fully transparent color
Color(255,255,255,0) never occurs.
black, BLACK, blue, BLUE, cyan, CYAN, DARK_GRAY, darkGray, gray, GRAY, green, GREEN, LIGHT_GRAY, lightGray, magenta, MAGENTA, orange, ORANGE, pink, PINK, red, RED, white, WHITE, yellow, YELLOWBITMASK, OPAQUE, TRANSLUCENT| Constructor and Description |
|---|
IlvBlinkingMultiColor(Color... color)
Creates a new multi blinking color.
|
IlvBlinkingMultiColor(long period,
Color... color)
Creates a new multi blinking color.
|
| Modifier and Type | Method and Description |
|---|---|
PaintContext |
createContext(ColorModel cm,
Rectangle r,
Rectangle2D r2d,
AffineTransform xform,
RenderingHints hints)
Creates and returns a
PaintContext. |
boolean |
equals(Object obj)
Determines whether another object is equal to this
IlvBlinkingColor. |
Color[] |
getColors()
Returns the colors used in the different phases.
|
Color |
getCurrentColor()
Returns current color.
|
long |
getOffPeriod()
Returns the duration, in milliseconds, of the "off" period.
|
long |
getOnPeriod()
Returns the duration, in milliseconds, of the "on" period.
|
long |
getPeriod()
Returns the duration, in milliseconds, of the "on" and "off" period.
|
int |
getRGB()
Returns the RGB value representing the color in the default sRGB
ColorModel. |
int |
getTransparency()
Returns the transparency mode for this
Color. |
int |
hashCode()
Returns the hash code of this object.
|
boolean |
isOn()
Returns
true if this color displays like the "on" state,
and false if this color displays like the "off" state. |
void |
notifyUsed(IlvBlinkingObject obj,
boolean used)
Called by
IlvGraphic if this color is used. |
void |
setOn(boolean flag)
Sets whether this color displays like the "on" or "off" state.
|
void |
setTemporarilyDisabled(boolean flag)
Temporarily disable the blinking.
|
String |
toString()
Returns a string representation of the object.
|
brighter, darker, decode, getAlpha, getBlue, getColor, getColor, getColor, getColorComponents, getColorComponents, getColorSpace, getComponents, getComponents, getGreen, getHSBColor, getRed, getRGBColorComponents, getRGBComponents, HSBtoRGB, RGBtoHSBpublic IlvBlinkingMultiColor(Color... color)
color - A number of colors (at least 2) used during the periods.public IlvBlinkingMultiColor(long period,
Color... color)
period - Duration, in milliseconds, of each periodcolor - A number of colors (at least 2) used during the periods.public boolean equals(Object obj)
IlvBlinkingColor.public int hashCode()
public PaintContext createContext(ColorModel cm, Rectangle r, Rectangle2D r2d, AffineTransform xform, RenderingHints hints)
PaintContext.
If the current state is on, it returns a context representing the "on
color", otherwise the "off color".createContext in interface PaintcreateContext in class Colorcm - the specified ColorModelr - the specified Rectangler2d - the specified Rectangle2Dxform - the specified AffineTransformhints - the specified RenderingHintsPaintContext that is used to generate a
solid color pattern.Color.createContext(java.awt.image.ColorModel, java.awt.Rectangle, java.awt.geom.Rectangle2D, java.awt.geom.AffineTransform, java.awt.RenderingHints),
Paint,
PaintContextpublic int getTransparency()
Color.
If the current state is on, it returns a transparency of the "on
color", otherwise of the "off color".getTransparency in interface TransparencygetTransparency in class ColorColor object's transparency mode.Paint,
Transparencypublic int getRGB()
ColorModel.
(Bits 24-31 are alpha, 16-23 are red, 8-15 are green, 0-7 are
blue).public Color getCurrentColor()
public Color[] getColors()
public long getPeriod()
public long getOnPeriod()
getPeriod().getOnPeriod in interface IlvBlinkingDrawingResourcepublic long getOffPeriod()
getPeriod().getOffPeriod in interface IlvBlinkingDrawingResourcepublic void setOn(boolean flag)
setOn in interface IlvBlinkingDrawingResourceflag - true means it displays like the "on" statepublic boolean isOn()
true if this color displays like the "on" state,
and false if this color displays like the "off" state.isOn in interface IlvBlinkingDrawingResourcepublic void setTemporarilyDisabled(boolean flag)
setTemporarilyDisabled in interface IlvBlinkingDrawingResourceflag - true if temporarily disabled.public void notifyUsed(IlvBlinkingObject obj, boolean used)
IlvGraphic if this color is used.
You should not call this method.notifyUsed in interface IlvBlinkingDrawingResourceobj - The blinking object.used - Whether the color is used.© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.