Class ColorUIResource
java.lang.Object
java.awt.Color
javax.swing.plaf.ColorUIResource
- All Implemented Interfaces:
Paint, Transparency, Serializable, UIResource
A subclass of Color that implements UIResource. UI
classes that create colors should use this class.
Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing. As of 1.4, support for long term storage
of all JavaBeans
has been added to the java.beans package.
Please see XMLEncoder.
- See Also:
-
Field Summary
Fields inherited from class Color
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, YELLOWModifier and TypeFieldDescriptionstatic final ColorThe color black.static final ColorThe color black.static final ColorThe color blue.static final ColorThe color blue.static final ColorThe color cyan.static final ColorThe color cyan.static final ColorThe color dark gray.static final ColorThe color dark gray.static final ColorThe color gray.static final ColorThe color gray.static final ColorThe color green.static final ColorThe color green.static final ColorThe color light gray.static final ColorThe color light gray.static final ColorThe color magenta.static final ColorThe color magenta.static final ColorThe color orange.static final ColorThe color orange.static final ColorThe color pink.static final ColorThe color pink.static final ColorThe color red.static final ColorThe color red.static final ColorThe color white.static final ColorThe color white.static final ColorThe color yellow.static final ColorThe color yellow.Fields inherited from interface Transparency
BITMASK, OPAQUE, TRANSLUCENTModifier and TypeFieldDescriptionstatic final intRepresents image data that is guaranteed to be either completely opaque, with an alpha value of 1.0, or completely transparent, with an alpha value of 0.0.static final intRepresents image data that is guaranteed to be completely opaque, meaning that all pixels have an alpha value of 1.0.static final intRepresents image data that contains or might contain arbitrary alpha values between and including 0.0 and 1.0. -
Constructor Summary
ConstructorsConstructorDescriptionColorUIResource(float r, float g, float b) Constructs aColorUIResource.ColorUIResource(int rgb) Constructs aColorUIResource.ColorUIResource(int r, int g, int b) Constructs aColorUIResource.Constructs aColorUIResource. -
Method Summary
Methods inherited from class Color
brighter, createContext, darker, decode, equals, getAlpha, getBlue, getColor, getColor, getColor, getColorComponents, getColorComponents, getColorSpace, getComponents, getComponents, getGreen, getHSBColor, getRed, getRGB, getRGBColorComponents, getRGBComponents, getTransparency, hashCode, HSBtoRGB, RGBtoHSB, toStringModifier and TypeMethodDescriptionbrighter()Creates a newColorthat is a brighter version of thisColor.createContext(ColorModel cm, Rectangle r, Rectangle2D r2d, AffineTransform xform, RenderingHints hints) Creates and returns aPaintContextused to generate a solid color field pattern.darker()Creates a newColorthat is a darker version of thisColor.static ColorConverts aStringto an integer and returns the specified opaqueColor.booleanDetermines whether another object is equal to thisColor.intgetAlpha()Returns the alpha component in the range 0-255.intgetBlue()Returns the blue component in the range 0-255 in the default sRGB space.static ColorFinds a color in the system properties.static ColorFinds a color in the system properties.static ColorFinds a color in the system properties.float[]getColorComponents(float[] compArray) Returns afloatarray containing only the color components of theColor, in theColorSpaceof theColor.float[]getColorComponents(ColorSpace cspace, float[] compArray) Returns afloatarray containing only the color components of theColorin theColorSpacespecified by thecspaceparameter.Returns theColorSpaceof thisColor.float[]getComponents(float[] compArray) Returns afloatarray containing the color and alpha components of theColor, in theColorSpaceof theColor.float[]getComponents(ColorSpace cspace, float[] compArray) Returns afloatarray containing the color and alpha components of theColor, in theColorSpacespecified by thecspaceparameter.intgetGreen()Returns the green component in the range 0-255 in the default sRGB space.static ColorgetHSBColor(float h, float s, float b) Creates aColorobject based on the specified values for the HSB color model.intgetRed()Returns the red component in the range 0-255 in the default sRGB space.intgetRGB()Returns the RGB value representing the color in the default sRGBColorModel.float[]getRGBColorComponents(float[] compArray) Returns afloatarray containing only the color components of theColor, in the default sRGB color space.float[]getRGBComponents(float[] compArray) Returns afloatarray containing the color and alpha components of theColor, as represented in the default sRGB color space.intReturns the transparency mode for thisColor.inthashCode()Computes the hash code for thisColor.static intHSBtoRGB(float hue, float saturation, float brightness) Converts the components of a color, as specified by the HSB model, to an equivalent set of values for the default RGB model.static float[]RGBtoHSB(int r, int g, int b, float[] hsbvals) Converts the components of a color, as specified by the default RGB model, to an equivalent set of values for hue, saturation, and brightness that are the three components of the HSB model.toString()Returns a string representation of thisColor.Methods inherited from class Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitModifier and TypeMethodDescriptionprotected Objectclone()Creates and returns a copy of this object.protected voidfinalize()Deprecated, for removal: This API element is subject to removal in a future version.Finalization is deprecated and subject to removal in a future release.final Class<?> getClass()Returns the runtime class of thisObject.final voidnotify()Wakes up a single thread that is waiting on this object's monitor.final voidWakes up all threads that are waiting on this object's monitor.final voidwait()Causes the current thread to wait until it is awakened, typically by being notified or interrupted.final voidwait(long timeoutMillis) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.final voidwait(long timeoutMillis, int nanos) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
-
Constructor Details
-
ColorUIResource
Constructs aColorUIResource.- Parameters:
r- the red componentg- the green componentb- the blue component
-
ColorUIResource
public ColorUIResource(int rgb) Constructs aColorUIResource.- Parameters:
rgb- the combined RGB components
-
ColorUIResource
public ColorUIResource(float r, float g, float b) Constructs aColorUIResource.- Parameters:
r- the red componentg- the green componentb- the blue component
-
ColorUIResource
-