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:lisong_mechlab.view.graphs.WeaponColouredDrawingSupplier.java

private Color colorShift(Color aColour, int aMax, int aCurr) {
    float hsb[] = new float[3];
    Color.RGBtoHSB(aColour.getRed(), aColour.getGreen(), aColour.getBlue(), hsb);

    float blend = aMax == 1 ? 1.0f : (float) aCurr / (aMax - 1);
    float range_min = 0.55f;
    float range_max = 1.0f;
    float saturation = (range_max - range_min) * blend + range_min;

    hsb[1] *= saturation;/*from  w w  w.  ja  v  a 2 s . c o m*/
    hsb[2] *= saturation;

    return new Color(Color.HSBtoRGB(hsb[0], hsb[1], hsb[2]));
}

From source file:org.pentaho.ui.xul.swt.tags.SwtBox.java

public void setBgcolor(String bgcolor) {
    this.bgcolor = bgcolor;
    Color c = Color.decode(bgcolor);
    box.setBackground(//from   w  w  w.ja v a  2 s  .com
            new org.eclipse.swt.graphics.Color(box.getDisplay(), c.getRed(), c.getGreen(), c.getBlue()));
    box.setBackgroundMode(SWT.INHERIT_DEFAULT);
}

From source file:org.xwiki.properties.internal.converter.ColorConverter.java

@Override
protected String convertToString(Color value) {
    Color colorValue = value;

    return MessageFormat.format("{0}, {1}, {2}", colorValue.getRed(), colorValue.getGreen(),
            colorValue.getBlue());/* w  ww.j av a 2  s.c  o  m*/
}

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

private static String toRGBFunctionCall(Color color) {
    StringBuffer sbuf = new StringBuffer();
    sbuf.append('#');
    String s = Integer.toHexString(color.getRed());
    if (s.length() == 1) {
        sbuf.append('0');
    }//from www .  j  a v  a  2 s  .c  om
    sbuf.append(s);
    s = Integer.toHexString(color.getGreen());
    if (s.length() == 1) {
        sbuf.append('0');
    }
    sbuf.append(s);
    s = Integer.toHexString(color.getBlue());
    if (s.length() == 1) {
        sbuf.append('0');
    }
    sbuf.append(s);
    if (color.getAlpha() != 255) {
        s = Integer.toHexString(color.getAlpha());
        if (s.length() == 1) {
            sbuf.append('0');
        }
        sbuf.append(s);
    }
    return sbuf.toString();
}

From source file:savant.settings.PersistentSettings.java

public void setColour(String key, Color value) {
    setProperty(key, String.format("%02X%02X%02X%02X", value.getRed(), value.getGreen(), value.getBlue(),
            value.getAlpha()));//from   ww  w  . j a  v a 2  s  .co m
}

From source file:net.sourceforge.entrainer.socket.FlashColour.java

/**
 * Sets the color./* w w  w  .j  av a 2 s.  c o m*/
 *
 * @param c
 *          the new color
 */
@JsonIgnore
public void setColor(Color c) {
    if (c == null)
        return;
    setRed(c.getRed());
    setGreen(c.getGreen());
    setBlue(c.getBlue());
    setAlpha(c.getAlpha());
}

From source file:com.anrisoftware.prefdialog.miscswing.lists.RubberBandingList.java

private Color createSelectionColor() {
    Color c = getSelectionBackground();
    int r = c.getRed(), g = c.getGreen(), b = c.getBlue();
    return r > g ? r > b ? new Color(r, 0, 0) : new Color(0, 0, b)
            : g > b ? new Color(0, g, 0) : new Color(0, 0, b);
}

From source file:com.rapidminer.gui.new_plotter.engine.jfreechart.renderer.FormattedXYDifferenceRenderer.java

@Override
public Paint getNegativePaint() {
    StaticDebug.debug("getNegativePaint(): " + trueSeriesIdx);
    Color color = getFormatDelegate().getSeriesColor(trueSeriesIdx);
    if (color != null) {
        return (new Color(255 - color.getRed(), 255 - color.getGreen(), 255 - color.getBlue(),
                color.getAlpha() / 2));//from w  ww .java 2s. c  om
    } else {
        return super.getNegativePaint();
    }
}

From source file:org.jtrfp.trcl.SkySystem.java

public boolean areStarsVisible() {
    Color c = getHorizonGradientTop();
    return c.getRed() + c.getGreen() + c.getBlue() < 25 || !hasClouds();
}

From source file:edu.gmu.cs.sim.util.media.chart.SeriesAttributes.java

/** Given an opaque color and a desired opacity (from 0.0 to 1.0), returns a new color of the same tint but with
 the given opacity. *//*from  w  w w .j a v  a 2 s.c o m*/
public Color reviseColor(Color c, double opacity) {
    return new Color(c.getRed(), c.getGreen(), c.getBlue(), (int) (opacity * 255));
}