Example usage for java.awt Color getGreen

List of usage examples for java.awt Color getGreen

Introduction

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

Prototype

public int getGreen() 

Source Link

Document

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

Usage

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

/**
 * Creates new color bean//  w ww  . jav a  2 s .  c  o 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:org.lnicholls.galleon.util.Tools.java

public static Color darken(Color color) {
    return new Color((int) (color.getRed() * 0.59), (int) (color.getGreen() * 0.59),
            (int) (color.getBlue() * 0.59));
}

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  v a2s  .  co m
        } 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.tros.utils.converters.ColorConverter.java

/**
 * Convert./*from  www . jav a2 s.  c o m*/
 *
 * @param <T>
 * @param type
 * @param value
 * @return
 */
@Override
@SuppressWarnings("unchecked")
public <T> T convert(Class<T> type, Object value) {
    if (type == String.class) {
        if (value.getClass() == Color.class) {
            Color c = (Color) value;
            return (T) String.format("#%02x%02x%02x", c.getRed(), c.getGreen(), c.getBlue());
        } else {
            return (T) value;
        }
    } else {
        try {
            return (T) Color.class.getField(value.toString()).get(null);
        } catch (NoSuchFieldException ex) {
        } catch (SecurityException | IllegalArgumentException | IllegalAccessException ex) {
        }
        return (T) Color.decode(value.toString());
    }
}

From source file:ColorPicker3.java

protected int toGray(Color c) {
    int r = c.getRed();
    int g = c.getGreen();
    int b = c.getBlue();
    // Grab the luminance the same way GIMP does...
    return (int) Math.round(0.3 * r + 0.59 * g + 0.11 * b);
}

From source file:net.sf.mzmine.modules.peaklistmethods.dataanalysis.projectionplots.ProjectionPlotRenderer.java

private boolean isAvoidColor(Color color) {
    for (Color c : avoidColors) {
        if ((color.getRed() >= c.getRed()) && (color.getGreen() >= c.getGreen())
                && (color.getBlue() >= c.getBlue()))
            return true;
    }//w  ww.j av a2s.c  o  m

    return false;
}

From source file:dr.PlotRenderer.java

private boolean isAvoidColor(Color color) {
    for (Color c : avoidColors) {
        if ((color.getRed() >= c.getRed()) && (color.getGreen() >= c.getGreen())
                && (color.getBlue() >= c.getBlue())) {
            return true;
        }/*w  w w .j a v a2  s .c o m*/
    }

    return false;
}

From source file:guineu.modules.visualization.intensityboxplot.IntensityBoxPlotDrawingSupplier.java

public Paint getNextPaint() {

    // get new color from the default supplier
    Color baseColor = (Color) super.getNextPaint();

    // ban colors that are too bright
    int colorSum = baseColor.getRed() + baseColor.getGreen() + baseColor.getBlue();
    if (colorSum > 520)
        baseColor = baseColor.darker();//from  w ww  .ja  v  a 2 s .co m

    return baseColor;
}

From source file:gr.iti.mklab.reveal.forensics.util.Util.java

public static int[][][] getRGBArray(BufferedImage imageIn) {
    // possible 10-fold speed increase in:
    // http://stackoverflow.com/questions/6524196/java-get-pixel-array-from-image
    // (but ensure all major bases are covered)
    int ImW = imageIn.getWidth();
    int ImH = imageIn.getHeight();
    Color tmpColor;
    int[][][] rgbValues = new int[3][ImW][ImH];

    for (int ii = 0; ii < ImW; ii++) {
        for (int jj = 0; jj < ImH; jj++) {
            tmpColor = new Color(imageIn.getRGB(ii, jj));
            rgbValues[0][ii][jj] = tmpColor.getRed();
            rgbValues[1][ii][jj] = tmpColor.getGreen();
            rgbValues[2][ii][jj] = tmpColor.getBlue();
        }// www . j  av a  2  s  .c o  m
    }
    return rgbValues;
}

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();
}