Package com.github.tadukoo.view.paint
Class ColorPaintUIResource
java.lang.Object
java.awt.Color
javax.swing.plaf.ColorUIResource
com.github.tadukoo.view.paint.ColorPaintUIResource
- All Implemented Interfaces:
PaintUIResource
,SizablePaint
,Paint
,Transparency
,Serializable
,UIResource
ColorPaintUIResource is a
PaintUIResource
to be used in
Tadukoo Look & Feel (or other custom Look & Feels if desired) for custom paints if you want a solid color.
Using this class allows supporting other component UI classes that may not allow a solid color. It extends
ColorUIResource
.- Since:
- Alpha v.0.2
- Version:
- Alpha v.0.3
- Author:
- Logan Ferree (Tadukoo)
- See Also:
-
Field Summary
Fields inherited from class java.awt.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
Fields inherited from interface java.awt.Transparency
BITMASK, OPAQUE, TRANSLUCENT
-
Constructor Summary
ConstructorDescriptionColorPaintUIResource
(float r, float g, float b) Create a ColorPaintUIResource using the separate RGB components as floats.ColorPaintUIResource
(int rgb) Create a ColorPaintUIResource using the combined RGB components.ColorPaintUIResource
(int r, int g, int b) Create a ColorPaintUIResource using the separate RGB components.ColorPaintUIResource
(Color color) Create a ColorPaintUIResource using aColor
.ColorPaintUIResource
(ColorUIResource colorUIResource) Create a ColorPaintUIResource using aColorUIResource
. -
Method Summary
Modifier and TypeMethodDescriptionIn some cases, we need to return a ColorUIResource to support the Look & Feel properly.Metal Look and Feel has a trash way of handling gradients.Returns this as the Paint, since it's an extension ofColor
.Methods inherited from class java.awt.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
-
Constructor Details
-
ColorPaintUIResource
Create a ColorPaintUIResource using aColorUIResource
.- Parameters:
colorUIResource
- TheColorUIResource
to use for this ColorPaintUIResource
-
ColorPaintUIResource
Create a ColorPaintUIResource using aColor
.- Parameters:
color
- TheColor
to use for this ColorPaintUIResource
-
ColorPaintUIResource
public ColorPaintUIResource(int rgb) Create a ColorPaintUIResource using the combined RGB components.- Parameters:
rgb
- The combined RGB components to use for this ColorPaintUIResource
-
ColorPaintUIResource
public ColorPaintUIResource(int r, int g, int b) Create a ColorPaintUIResource using the separate RGB components.- Parameters:
r
- The red component of the colorg
- The green component of the colorb
- The blue component of the color
-
ColorPaintUIResource
public ColorPaintUIResource(float r, float g, float b) Create a ColorPaintUIResource using the separate RGB components as floats.- Parameters:
r
- The red component of the colorg
- The green component of the colorb
- The blue component of the color
-
-
Method Details
-
getPaint
Returns this as the Paint, since it's an extension ofColor
.- Specified by:
getPaint
in interfaceSizablePaint
- Parameters:
size
- The Dimensions of the object to be painted- Returns:
- this
-
getColorUIResource
Description copied from interface:PaintUIResource
In some cases, we need to return a ColorUIResource to support the Look & Feel properly. I don't like it, but it needs to be done for those Look & Feel pieces to work, and I'm trying to support all of them.- Specified by:
getColorUIResource
in interfacePaintUIResource
- Returns:
- this
-
getMetalGradientList
Description copied from interface:PaintUIResource
Metal Look and Feel has a trash way of handling gradients. Basically it takes 3 colors and 2 fractions, but with the 3 colors, it repeats color 1 and does 1, 2, 1, 3. The fractions represent the 2 middle points, but the 2nd point is calculated as mid1 * 2 + mid2.
This method exists for the purpose of appeasing the Metal Look & Feel god who decided this disgusting way of code.- Specified by:
getMetalGradientList
in interfacePaintUIResource
- Returns:
- A
List<Object>
for use in Metal gradients that will produce a solid color
-