Spec-Zone.ru › OpenJDK 27

Class ColorUIResource

java.lang.Object
java.awt.Color
javax.swing.plaf.ColorUIResource
All Implemented Interfaces:
Paint, Transparency, Serializable, UIResource
public class ColorUIResource extends Color implements 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:
  • UIResource

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, YELLOW
Modifier and Type Field Description
static final Color black
The color black.
static final Color BLACK
The color black.
static final Color blue
The color blue.
static final Color BLUE
The color blue.
static final Color cyan
The color cyan.
static final Color CYAN
The color cyan.
static final Color DARK_GRAY
The color dark gray.
static final Color darkGray
The color dark gray.
static final Color gray
The color gray.
static final Color GRAY
The color gray.
static final Color green
The color green.
static final Color GREEN
The color green.
static final Color LIGHT_GRAY
The color light gray.
static final Color lightGray
The color light gray.
static final Color magenta
The color magenta.
static final Color MAGENTA
The color magenta.
static final Color orange
The color orange.
static final Color ORANGE
The color orange.
static final Color pink
The color pink.
static final Color PINK
The color pink.
static final Color red
The color red.
static final Color RED
The color red.
static final Color white
The color white.
static final Color WHITE
The color white.
static final Color yellow
The color yellow.
static final Color YELLOW
The color yellow.

Fields declared in interface Transparency

BITMASK, OPAQUE, TRANSLUCENT
Modifier and Type Field Description
static final int BITMASK
Represents 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 int OPAQUE
Represents image data that is guaranteed to be completely opaque, meaning that all pixels have an alpha value of 1.0.
static final int TRANSLUCENT
Represents image data that contains or might contain arbitrary alpha values between and including 0.0 and 1.0.

Constructor Summary

Constructor Description
ColorUIResource(float r, float g, float b)
Constructs a ColorUIResource.
ColorUIResource(int rgb)
Constructs a ColorUIResource.
ColorUIResource(int r, int g, int b)
Constructs a ColorUIResource.
ColorUIResource(Color c)
Constructs a ColorUIResource.

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, toString
Modifier and Type Method Description
Color brighter()
Creates a new Color that is a brighter version of this Color.
PaintContext createContext(ColorModel cm, Rectangle r, Rectangle2D r2d, AffineTransform xform, RenderingHints hints)
Creates and returns a PaintContext used to generate a solid color field pattern.
Color darker()
Creates a new Color that is a darker version of this Color.
static Color decode(String nm)
Converts a String to an integer and returns the specified opaque Color.
boolean equals(Object obj)
Determines whether another object is equal to this Color.
int getAlpha()
Returns the alpha component in the range 0-255.
int getBlue()
Returns the blue component in the range 0-255 in the default sRGB space.
static Color getColor(String nm)
Finds a color in the system properties.
static Color getColor(String nm, int v)
Finds a color in the system properties.
static Color getColor(String nm, Color v)
Finds a color in the system properties.
float[] getColorComponents(float[] compArray)
Returns a float array containing only the color components of the Color, in the ColorSpace of the Color.
float[] getColorComponents(ColorSpace cspace, float[] compArray)
Returns a float array containing only the color components of the Color in the ColorSpace specified by the cspace parameter.
ColorSpace getColorSpace()
Returns the ColorSpace of this Color.
float[] getComponents(float[] compArray)
Returns a float array containing the color and alpha components of the Color, in the ColorSpace of the Color.
float[] getComponents(ColorSpace cspace, float[] compArray)
Returns a float array containing the color and alpha components of the Color, in the ColorSpace specified by the cspace parameter.
int getGreen()
Returns the green component in the range 0-255 in the default sRGB space.
static Color getHSBColor(float h, float s, float b)
Creates a Color object based on the specified values for the HSB color model.
int getRed()
Returns the red component in the range 0-255 in the default sRGB space.
int getRGB()
Returns the RGB value representing the color in the default sRGB ColorModel, 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 a float array containing only the color components of the Color, in the default sRGB color space.
float[] getRGBComponents(float[] compArray)
Returns a float array containing the color and alpha components of the Color, as represented in the default sRGB color space.
int getTransparency()
Returns the transparency mode for this Color.
int hashCode()
Computes the hash code for this Color.
static int HSBtoRGB(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.
String toString()
Returns a string representation of this Color.

Methods declared in class Object

clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Modifier and Type Method Description
protected Object clone()
Creates and returns a copy of this object.
protected void finalize()
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 this Object.
final void notify()
Wakes up a single thread that is waiting on this object's monitor.
final void notifyAll()
Wakes up all threads that are waiting on this object's monitor.
final void wait()
Causes the current thread to wait until it is awakened, typically by being notified or interrupted.
final void wait(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 void wait(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

@ConstructorProperties({"red","green","blue"}) public ColorUIResource(int r, int g, int b)
Constructs a ColorUIResource.
Parameters:
r - the red component
g - the green component
b - the blue component

ColorUIResource

public ColorUIResource(int rgb)
Constructs a ColorUIResource.
Parameters:
rgb - the combined RGB components

ColorUIResource

public ColorUIResource(float r, float g, float b)
Constructs a ColorUIResource.
Parameters:
r - the red component
g - the green component
b - the blue component

ColorUIResource

public ColorUIResource(Color c)
Constructs a ColorUIResource.
Parameters:
c - the color

Report a bug or suggest an enhancement
For further API reference and developer documentation see the Java SE Documentation, which contains more detailed, developer-targeted descriptions with conceptual overviews, definitions of terms, workarounds, and working code examples. Other versions.
Java is a trademark or registered trademark of Oracle and/or its affiliates in the US and other countries.
Copyright © 1993, 2026, Oracle and/or its affiliates, 500 Oracle Parkway, Redwood Shores, CA 94065 USA.
All rights reserved. Use is subject to license terms and the documentation redistribution policy.

© 1993, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API