|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.kzoo.util.RandColorGenerator
Kalamazoo College Utility Classes:
The edu.kzoo.util.RandColorGenerator
class provides
a static
method that can be used to generate a
random color.
Example of how to use RandColorGenerator
:
RandColorGenerator randColorGen = RandColorGenerator.getInstance();
Color opaqueColor = randColorGen.nextColor();
Color colorWithSpecifiedTransparency = randColorGen.nextColor(alpha);
Color colorWithRandomTransparency =
randColorGen.nextColorWithVariableTransparency();
Method Summary | |
static RandColorGenerator |
getInstance()
Returns a random color generator. |
java.awt.Color |
nextColor()
Returns the next pseudorandom opaque Color value
from this random color generator's sequence. |
java.awt.Color |
nextColor(int alpha)
Returns the next pseudorandom Color value with the
specified transparency level from this random color generator's
sequence. |
java.awt.Color |
nextColorWithVariableTransparency()
Returns the next pseudorandom Color value from this
random color generator's sequence. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static RandColorGenerator getInstance()
RandColorGenerator
object to
provide a better sequence of random colors.
public java.awt.Color nextColor()
Color
value
from this random color generator's sequence.
public java.awt.Color nextColor(int alpha)
Color
value with the
specified transparency level from this random color generator's
sequence.
alpha
- the transparency level to use for the next
color, in the range of 0 to 255 where 255 is
completely opaque
public java.awt.Color nextColorWithVariableTransparency()
Color
value from this
random color generator's sequence. Colors returned by this method
are created with a random alpha (transparency) component, as well as
random red, green, and blue components.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |