Example usage for java.awt Color getBlue

List of usage examples for java.awt Color getBlue

Introduction

In this page you can find the example usage for java.awt Color getBlue.

Prototype

public int getBlue() 

Source Link

Document

Returns the blue component in the range 0-255 in the default sRGB space.

Usage

From source file:lu.lippmann.cdb.graph.GraphUtil.java

/**
 * return if background of a node is dark or not
 * /* w  w  w .j av a 2 s.c om*/
 * @param v
 * @return
 */
public static boolean isDarkNode(final CNode v) {
    final Color c = v.getColor();
    return ((c.getBlue() + c.getGreen() + c.getRed()) / 3 < 128);
}

From source file:Main.java

public TranslucentJPanel(Color bgColor) {
    this.red = bgColor.getRed();
    this.green = bgColor.getGreen();
    this.blue = bgColor.getBlue();
}

From source file:com.github.nbyl.xfdcontrol.plugins.notification.blink1.Blink1ToolCommand.java

@VisibleForTesting
String mapColorToRgbArgument(Color color) {
    return color.getRed() + "," + color.getGreen() + "," + color.getBlue();
}

From source file:Main.java

@Override
protected void paintComponent(Graphics g) {
    super.paintComponent(g);
    Color color = getBackground();
    String text = color.getRed() + "x" + color.getGreen() + "x" + color.getBlue();

    g.drawString(text, 20, 30);//from w  ww  .  ja v  a2s.c o m
}

From source file:com.galenframework.rainbow4j.colorscheme.SimpleColorClassifier.java

public SimpleColorClassifier(String name, Color color) {
    this.name = name;
    this.red = color.getRed();
    this.blue = color.getBlue();
    this.green = color.getGreen();
}

From source file:org.nuclos.client.common.Utils.java

public static String colorToHexString(Color c) {
    char[] buf = new char[7];
    buf[0] = '#';
    String s = Integer.toHexString(c.getRed());
    if (s.length() == 1) {
        buf[1] = '0';
        buf[2] = s.charAt(0);//  w w w  .j a va 2  s.  c o m
    } else {
        buf[1] = s.charAt(0);
        buf[2] = s.charAt(1);
    }
    s = Integer.toHexString(c.getGreen());
    if (s.length() == 1) {
        buf[3] = '0';
        buf[4] = s.charAt(0);
    } else {
        buf[3] = s.charAt(0);
        buf[4] = s.charAt(1);
    }
    s = Integer.toHexString(c.getBlue());
    if (s.length() == 1) {
        buf[5] = '0';
        buf[6] = s.charAt(0);
    } else {
        buf[5] = s.charAt(0);
        buf[6] = s.charAt(1);
    }
    return String.valueOf(buf);
}

From source file:net.sourceforge.atunes.kernel.modules.state.ColorBean.java

/**
 * Creates new color bean//from   ww  w .  ja  v  a2s  . co  m
 * 
 * @param c
 */
public ColorBean(final Color c) {
    this.red = c.getRed();
    this.green = c.getGreen();
    this.blue = c.getBlue();
    this.alpha = c.getAlpha();
}

From source file:util.ui.UiUtilities.java

/**
 * returns a color code as used in HTML, e.g. #FF0000 for pure red
 * @param color//  w w w.  ja  va2 s.  co m
 * @return HTML color code
 */
public static String getHTMLColorCode(Color color) {
    return '#' + StringUtils.leftPad(Integer.toString(color.getRed(), 16), 2, '0')
            + StringUtils.leftPad(Integer.toString(color.getGreen(), 16), 2, '0')
            + StringUtils.leftPad(Integer.toString(color.getBlue(), 16), 2, '0');
}

From source file:ToggleButton.java

public void actionPerformed(ActionEvent e) {
    Color color = display.getBackground();
    int red = color.getRed();
    int green = color.getGreen();
    int blue = color.getBlue();

    if (e.getActionCommand() == "red") {
        if (red == 0) {
            red = 255;//from w  w  w. ja  va2 s  .c  om
        } else {
            red = 0;
        }
    }

    if (e.getActionCommand() == "green") {
        if (green == 0) {
            green = 255;
        } else {
            green = 0;
        }
    }

    if (e.getActionCommand() == "blue") {
        if (blue == 0) {
            blue = 255;
        } else {
            blue = 0;
        }
    }

    Color setCol = new Color(red, green, blue);
    display.setBackground(setCol);
}

From source file:org.apache.fop.util.ColorUtil.java

private static String toCIELabFunctionCall(ColorWithAlternatives color) {
    Color fallbackColor = getsRGBFallback(color);
    StringBuffer sb = new StringBuffer("cie-lab-color(");
    sb.append(fallbackColor.getRed()).append(',');
    sb.append(fallbackColor.getGreen()).append(',');
    sb.append(fallbackColor.getBlue());
    CIELabColorSpace cs = (CIELabColorSpace) color.getColorSpace();
    float[] lab = cs.toNativeComponents(color.getColorComponents(null));
    for (int i = 0; i < 3; i++) {
        sb.append(',').append(lab[i]);
    }//from   w  ww .j  a  v  a 2 s. c o m
    sb.append(')');
    return sb.toString();
}