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

From source file:playground.johannes.socialnetworks.graph.spatial.io.KMLVertexColorStyle.java

public List<StyleType> getObjectStyle(G graph) {
    TDoubleObjectHashMap<String> values = getValues(graph);
    double[] keys = values.keys();
    double min = StatUtils.min(keys);
    double max = StatUtils.max(keys);

    List<StyleType> styleTypes = new ArrayList<StyleType>(keys.length);
    styleIdMappings = new TDoubleObjectHashMap<String>();

    for (double val : keys) {
        StyleType styleType = objectFactory.createStyleType();
        styleType.setId(values.get(val));

        IconStyleType iconStyle = objectFactory.createIconStyleType();
        iconStyle.setIcon(vertexIconLink);
        iconStyle.setScale(0.5);/* w w  w .j  av  a  2 s. c  o  m*/
        //         iconStyle.setScale(1.0);

        Color c = colorForValue(val, min, max);
        iconStyle.setColor(
                new byte[] { (byte) c.getAlpha(), (byte) c.getBlue(), (byte) c.getGreen(), (byte) c.getRed() });

        styleType.setIconStyle(iconStyle);

        styleTypes.add(styleType);
        styleIdMappings.put(val, styleType.getId());
    }

    return styleTypes;
}

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:nl.softwaredesign.exporter.ODTExportFormat.java

/**
 * @param toConvert color to convert/*from w  w  w.ja  va2 s. com*/
 * @return the six character hex string (rrggbb) for the color
 */
private static String rgbHexValue(Color toConvert) {
    StringBuilder result = new StringBuilder();

    result.append(Integer.toHexString(toConvert.getRed()));
    if (result.length() < 2) {
        result.insert(0, '0');
    }

    result.append(Integer.toHexString(toConvert.getGreen()));
    if (result.length() < 4) {
        result.insert(2, '0');
    }

    result.append(Integer.toHexString(toConvert.getBlue()));
    if (result.length() < 6) {
        result.insert(4, '0');
    }

    return result.toString();
}

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

/**
 * Sets the color.// www. j a  v 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: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  ww .  j a v a  2 s .  co  m*/
public Color reviseColor(Color c, double opacity) {
    return new Color(c.getRed(), c.getGreen(), c.getBlue(), (int) (opacity * 255));
}

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));/*  ww w.j  av a2  s.  c  o  m*/
    } else {
        return super.getNegativePaint();
    }
}

From source file:org.wings.style.CSSStyleSheet.java

/**
 * Converts a type Color to a hex string
 * in the format "#RRGGBB"/*  w  w  w. j av  a2  s.c o m*/
 */
static String colorToHex(Color color) {
    String colorstr = "#";

    // Red
    String str = Integer.toHexString(color.getRed());
    if (str.length() > 2)
        str = str.substring(0, 2);
    if (str.length() < 2)
        colorstr += "0" + str;
    else
        colorstr += str;

    // Green
    str = Integer.toHexString(color.getGreen());
    if (str.length() > 2)
        str = str.substring(0, 2);
    if (str.length() < 2)
        colorstr += "0" + str;
    else
        colorstr += str;

    // Blue
    str = Integer.toHexString(color.getBlue());
    if (str.length() > 2)
        str = str.substring(0, 2);
    if (str.length() < 2)
        colorstr += "0" + str;
    else
        colorstr += str;

    return colorstr;
}

From source file:org.jfree.eastwood.GCategoryPlot.java

/**
 * Draws the gridlines for the plot./* ww w  .  j  a v  a  2s .co  m*/
 *
 * @param g2  the graphics device.
 * @param dataArea  the area inside the axes.
 * @param ticks  the ticks.
 *
 * @see #drawDomainGridlines(Graphics2D, Rectangle2D)
 */
protected void drawRangeGridlines(Graphics2D g2, Rectangle2D dataArea, List ticks) {
    // draw the range grid lines, if any...
    if (isRangeGridlinesVisible()) {
        Stroke gridStroke = getRangeGridlineStroke();
        Paint gridPaint = getRangeGridlinePaint();
        if ((gridStroke != null) && (gridPaint != null)) {
            ValueAxis axis = getRangeAxis();
            if (axis != null) {
                double lower = axis.getRange().getLowerBound();
                double upper = axis.getRange().getUpperBound();
                double y = lower;
                while (y <= upper) {
                    Paint paint = gridPaint;
                    if ((y == lower || y == upper) && gridPaint instanceof Color) {
                        Color c = (Color) gridPaint;
                        paint = new Color(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha() / 3);
                    }
                    try {
                        setRangeGridlinePaint(paint);
                        getRenderer().drawRangeGridline(g2, this, getRangeAxis(), dataArea, y);
                    } finally {
                        setRangeGridlinePaint(gridPaint);
                    }
                    y += this.yAxisStepSize;
                }
            }
        }
    }
}