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 declared in 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 declared in 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 declared in 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, consisting of the alpha component in bits 24-31, the red component in bits 16-23, the green component in bits 8-15, and the blue component in bits 0-7.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 declared in class Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitModifier and TypeMethodDescriptionprotected Objectclone()Answers a new instance of the same class as the receiver, whose slots have been filled in with the values in the slots of the receiver.protected voidfinalize()Deprecated, for removal: This API element is subject to removal in a future version.May cause performance issues, deadlocks and hangs.getClass()Answers the unique instance of java.lang.Class which represents the class of the receiver.final voidnotify()Causes one thread which iswaiting on the receiver to be made ready to run.final voidCauses all threads which arewaiting on the receiver to be made ready to run.final voidwait()Causes the thread which sent this message to be made not ready to run pending some change in the receiver (as indicated bynotifyornotifyAll).final voidwait(long time) Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated bynotifyornotifyAll) or the expiration of the timeout.final voidwait(long time, int frac) Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated bynotifyornotifyAll) or the expiration of the timeout.
-
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
-