Java Utililty Methods Color Value

List of utility methods to do Color Value

Description

The list of methods to do Color Value are organized into topic(s).

Method

ColorgetAsNotUIResource(Color color)
Returns a Color based on the param which is not of type UIResource.
if (!(color instanceof UIResource))
    return color;
float[] rgb = color.getRGBComponents(null);
return new Color(rgb[0], rgb[1], rgb[2], rgb[3]);
ColorgetBackgroundColor()
Returns background color for panels, as set by Look And Feel.
return (Color) UIManager.get("Panel.background");
ColorgetBlueGreyColor(Color base)
get Blue Grey Color
final Color c = nimbusDefaults == null ? null : nimbusDefaults.getColor("nimbusBlueGrey");
return c == null ? defaultBlueGreyColor(base) : c;
BordergetBorder(Color clr, int thickness)
get Border
return BorderFactory.createLineBorder(clr, thickness);
ColorgetColorBackground()
get Color Background
return UIManager.getDefaults().getColor("TabbedPane.background");
JColorChoosergetColorChooser()
Returns a color chooser on request.
if (colorChooser == null)
    colorChooser = new JColorChooser();
return colorChooser;
ColorgetColorForeground()
Returns the foreground color for the rule displayer.
return UIManager.getDefaults().getColor("TabbedPane.foreground");
ListgetColorLabels(Object obj)
get Color Labels
List<Field> labs = new LinkedList<Field>();
for (Field f : obj.getClass().getDeclaredFields()) {
    if (f.getType() == JLabel.class && f.getName().startsWith("_col")) {
        labs.add(f);
return labs;
ColorUIResourcegetColorTercio(Color a, Color b)
get Color Tercio
return new ColorUIResource(propInt(a.getRed(), b.getRed(), 3), propInt(a.getGreen(), b.getGreen(), 3),
        propInt(a.getBlue(), b.getBlue(), 3));
ColorgetColorValue(Element element, Object constant)
Gets a integer value of an attribute (e.g.
AttributeSet attributes = element.getAttributes();
Object obj = attributes.getAttribute(constant);
if (obj == null)
    return null;
return (Color) obj;