Example usage for java.awt Color equals

List of usage examples for java.awt Color equals

Introduction

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

Prototype

public boolean equals(Object obj) 

Source Link

Document

Determines whether another object is equal to this Color .

Usage

From source file:org.jboss.richfaces.integrationTest.actionParameter.ActionParameterTestCase.java

/**
 * Switching between skins and waiting for actual skin changes (detected by
 * label's background color changes).//from  w ww.  j a  v  a  2  s . c  o m
 */
@Test
public void testSelectingSkin() {
    for (String relation : MSG_RELATION_SKINS_COLORS) {
        final String[] msgSkinColor = StringUtils.split(relation, '|');
        final String msgInputSkin = msgSkinColor[0];
        final Color msgOutputColor = convertToAWTColor(msgSkinColor[1]);
        final String locAnchorSelectSkin = format(LOC_ANCHOR_SELECT_SKIN_PREFORMATTED, msgInputSkin);

        scrollIntoView(locAnchorSelectSkin, false);

        selenium.click(locAnchorSelectSkin);

        Wait.failWith(format("Color never changed to '{0}'", msgOutputColor)).until(new Condition() {
            public boolean isTrue() {
                Color actualColor = convertToAWTColor(getStyle(LOC_LABEL_CHANGE_SKIN, "background-color"));

                return msgOutputColor.equals(actualColor);
            }
        });
    }
}

From source file:com.rapidminer.gui.new_plotter.gui.GlobalConfigurationPanel.java

private void createPlotBackgroundColorDialog() {
    Color oldColor = getPlotConfiguration().getPlotBackgroundColor();
    if (oldColor == null) {
        oldColor = Color.white;/* www. j av a2s .  c o m*/
    }
    Color newBackgroundColor = JColorChooser.showDialog(this,
            I18N.getGUILabel(
                    "plotter.configuration_dialog.global_config_panel.plot_background_color_title.label"),
            oldColor);
    if (newBackgroundColor != null && !newBackgroundColor.equals(oldColor)) {
        getPlotConfiguration().setPlotBackgroundColor(newBackgroundColor);
    }
}

From source file:com.rapidminer.gui.new_plotter.gui.GlobalConfigurationPanel.java

private void createFrameBackgroundColorDialog() {
    Color oldColor = getPlotConfiguration().getChartBackgroundColor();
    if (oldColor == null) {
        oldColor = Color.white;//from   w  ww  . j  a v a 2s .c om
    }
    Color newBackgroundColor = JColorChooser.showDialog(this,
            I18N.getGUILabel(
                    "plotter.configuration_dialog.global_config_panel.chart_background_color_title.label"),
            oldColor);
    if (newBackgroundColor != null && !newBackgroundColor.equals(oldColor)) {
        getPlotConfiguration().setFrameBackgroundColor(newBackgroundColor);
    }
}

From source file:org.mrgeo.colorscale.ColorScale.java

public boolean equals(final ColorScale cs) {
    if (min == null && cs.min != null || min != null && cs.min == null) {
        return false;
    }//from  ww w .  java 2s  .  c  om
    if ((min != null && cs.min != null) && Double.compare(min, cs.min) != 0) {
        return false;
    }
    if (max == null && cs.max != null || max != null && cs.max == null) {
        return false;
    }
    if ((max != null && cs.max != null) && Double.compare(max, cs.max) != 0) {
        return false;
    }
    if (!scaling.equals(cs.scaling)) {
        return false;
    }
    if (interpolate != cs.interpolate) {
        return false;
    }
    if (forceValuesIntoRange != cs.forceValuesIntoRange) {
        return false;
    }
    if (reliefShading != cs.reliefShading) {
        return false;
    }
    if (nullColor.length != cs.nullColor.length) {
        return false;
    }
    for (int i = 0; i < nullColor.length; i++) {
        if (nullColor[i] != cs.nullColor[i]) {
            return false;
        }
    }
    if (size() != cs.size()) {
        return false;
    }
    final Iterator<Double> iterator1 = cs.keySet().iterator();
    for (final Double d1 : this.keySet()) {
        final Double d2 = iterator1.next();
        if (d1.compareTo(d2) != 0) {
            return false;
        }

        final Color value1 = get(d1);
        final Color value2 = get(d2);
        if (!value1.equals(value2)) {
            return false;
        }
    }
    return true;
}

From source file:com.orange.atk.graphAnalyser.LectureJATKResult.java

public String getcolor(Color color) {
    Map<String, Color> mapColor = CreateGraph.getMapColor();

    if (mapColor.containsValue(color)) {

        Set<String> cles = mapColor.keySet();
        Iterator<String> it = cles.iterator();
        while (it.hasNext()) {
            String cle = (String) it.next();
            Color tempcolor = mapColor.get(cle);
            if (tempcolor.equals(color))
                return cle;

        }/*w  w w  .j  av a 2  s . c o m*/

    }
    return null;
}

From source file:io.bci.BitcoinSTLGenerator.java

private static void drawSTL(File qrFile, String filename) {
    int height = 0;
    int width = 0;
    float PLATFORM_RATIO = 2.3f;
    float PLATFORM_HEIGHT = 1.0f;
    boolean printPlatform = false;
    boolean printQRbottom = true;
    STLDrawer drawer = null;/*  ww  w .  j  ava2s .  co m*/
    float[] pofloat1 = new float[3];
    float[] pofloat2 = new float[3];
    float[] pofloat3 = new float[3];
    float[] pofloat4 = new float[3];
    Color color;
    int count;
    BufferedImage image = null;

    try {
        drawer = new STLDrawer("STLs/" + filename + ".stl");
    } catch (FileNotFoundException e) {
        System.out.println("ERROR: Unable to create stl file! - " + filename + ".stl");
        e.printStackTrace();
    }

    try {
        image = javax.imageio.ImageIO.read(qrFile);
        height = image.getHeight();
        width = image.getWidth();

    } catch (IOException e) {
        System.out.println("ERROR: Unable to open picture file! - " + qrFile.toString());
        e.printStackTrace();
    }

    if (printPlatform) {
        //Base background
        pofloat1[0] = 0.0f;
        pofloat1[1] = 0.0f;
        pofloat1[2] = 0;

        pofloat2[0] = 0.0f + (float) width;
        pofloat2[1] = 0.0f + 0.0f;
        pofloat2[2] = 0;

        pofloat3[0] = 0.0f + (float) width;
        pofloat3[1] = 0.0f + (float) height;
        pofloat3[2] = 0;

        pofloat4[0] = 0.0f + 0.0f;
        pofloat4[1] = 0.0f + (float) height;
        pofloat4[2] = 0;
        drawer.drawCube(pofloat1, pofloat2, pofloat3, pofloat4, PLATFORM_HEIGHT);
        //end base background
    }

    int[][] drawArray = new int[width + 2][height + 2];

    for (int jj = 0; jj < height; jj++) {
        for (int ii = 0; ii < width; ii++) {
            color = new Color(image.getRGB(ii, jj));

            if (color.equals(Color.BLACK)) {
                drawArray[ii + 1][height - jj + 1] = 1; //PNG origin starts at top left of image, my origin is bottom left
            }
        }
    }

    count = 0;
    for (int jj = 1; jj < height + 2; jj++) //drawTop
    {

        for (int ii = 1; ii < width + 2; ii++) {
            if (drawArray[ii][jj] == 1) {
                while ((ii + count < width + 2) && (drawArray[ii + count][jj] == 1)
                        && (drawArray[ii + count][jj + 1] == 0)) {
                    count++;
                }

                pofloat1[0] = (float) ii;
                pofloat1[1] = (float) jj;
                pofloat1[2] = PLATFORM_HEIGHT;

                pofloat4[0] = (float) ii + 0.0f;
                pofloat4[1] = (float) jj + 1.0f;
                pofloat4[2] = PLATFORM_HEIGHT;

                pofloat3[0] = (float) ii + count;//1.0f;
                pofloat3[1] = (float) jj + 1.0f;
                pofloat3[2] = PLATFORM_HEIGHT;

                pofloat2[0] = (float) ii + 1.0f;
                pofloat2[1] = (float) jj + 0.0f;
                pofloat2[2] = PLATFORM_HEIGHT;

                ii = ii + count;

                if (count != 0) {
                    drawer.drawTop(pofloat1, pofloat2, pofloat3, pofloat4, PLATFORM_RATIO);
                }
                count = 0;
            }

        }

    }
    count = 0;
    for (int jj = 1; jj < height + 2; jj++) //bottom
    {

        for (int ii = 1; ii < width + 2; ii++) {
            if (drawArray[ii][jj] == 1) {
                while ((ii + count < width + 2) && (drawArray[ii + count][jj] == 1)
                        && (drawArray[ii + count][jj - 1] == 0)) {
                    count++;
                }

                pofloat1[0] = (float) ii;
                pofloat1[1] = (float) jj;
                pofloat1[2] = PLATFORM_HEIGHT;

                pofloat4[0] = (float) ii + 0.0f;
                pofloat4[1] = (float) jj + 1.0f;
                pofloat4[2] = PLATFORM_HEIGHT;

                pofloat3[0] = (float) ii + 1.0f;
                pofloat3[1] = (float) jj + 1.0f;
                pofloat3[2] = PLATFORM_HEIGHT;

                pofloat2[0] = (float) ii + count;//1.0f;
                pofloat2[1] = (float) jj + 0.0f;
                pofloat2[2] = PLATFORM_HEIGHT;

                if (count != 0) {
                    drawer.drawBottom(pofloat1, pofloat2, pofloat3, pofloat4, PLATFORM_RATIO);
                }
                ii = ii + count;
                count = 0;

            }

        }

    }

    for (int ii = 1; ii < width + 2; ii++) //draw right
    {

        for (int jj = 1; jj < height + 2; jj++) {
            if (drawArray[ii][jj] == 1) {
                while ((jj + count < height + 2) && (drawArray[ii][jj + count] == 1)
                        && (drawArray[ii + 1][jj + count] == 0)) {
                    count++;
                }

                pofloat1[0] = (float) ii;
                pofloat1[1] = (float) jj;
                pofloat1[2] = PLATFORM_HEIGHT;

                pofloat4[0] = (float) ii + 0.0f;
                pofloat4[1] = (float) jj + 1.0f;
                pofloat4[2] = PLATFORM_HEIGHT;

                pofloat3[0] = (float) ii + 1.0f;
                pofloat3[1] = (float) jj + count;//1.0f;
                pofloat3[2] = PLATFORM_HEIGHT;

                pofloat2[0] = (float) ii + 1.0f;
                pofloat2[1] = (float) jj + 0.0f;
                pofloat2[2] = PLATFORM_HEIGHT;

                if (count != 0) {
                    drawer.drawRight(pofloat1, pofloat2, pofloat3, pofloat4, PLATFORM_RATIO);
                }

                jj = jj + count;
                count = 0;
            }

        }

    }

    for (int ii = 1; ii < width + 2; ii++) //draw left
    {

        for (int jj = 1; jj < height + 2; jj++) {
            if (drawArray[ii][jj] == 1) {
                while ((jj + count < height + 2) && (drawArray[ii][jj + count] == 1)
                        && (drawArray[ii - 1][jj + count] == 0)) {
                    count++;
                }

                pofloat1[0] = (float) ii;
                pofloat1[1] = (float) jj;
                pofloat1[2] = PLATFORM_HEIGHT;

                pofloat4[0] = (float) ii + 0.0f;
                pofloat4[1] = (float) jj + count;//1.0f;
                pofloat4[2] = PLATFORM_HEIGHT;

                pofloat3[0] = (float) ii + 1.0f;
                pofloat3[1] = (float) jj + 1.0f;
                pofloat3[2] = PLATFORM_HEIGHT;

                pofloat2[0] = (float) ii + 1.0f;
                pofloat2[1] = (float) jj + 0.0f;
                pofloat2[2] = PLATFORM_HEIGHT;

                if (count != 0) {
                    drawer.drawLeft(pofloat1, pofloat2, pofloat3, pofloat4, PLATFORM_RATIO);
                }

                jj = jj + count;
                count = 0;
            }

        }

    }

    for (int jj = 1; jj < height + 2; jj++) //draw back
    {

        for (int ii = 1; ii < width + 2; ii++) {
            if (drawArray[ii][jj] == 1) {
                while ((ii + count < width + 2) && (drawArray[ii + count][jj] == 1)) {
                    count++;
                }

                pofloat1[0] = (float) ii;
                pofloat1[1] = (float) jj;
                pofloat1[2] = PLATFORM_HEIGHT;

                pofloat4[0] = (float) ii + 0.0f;
                pofloat4[1] = (float) jj + 1.0f;
                pofloat4[2] = PLATFORM_HEIGHT;

                pofloat3[0] = (float) ii + count;//1.0f;
                pofloat3[1] = (float) jj + 1.0f;
                pofloat3[2] = PLATFORM_HEIGHT;

                pofloat2[0] = (float) ii + count;//1.0f;
                pofloat2[1] = (float) jj + 0.0f;
                pofloat2[2] = PLATFORM_HEIGHT;

                if (count != 0) {
                    drawer.drawBack(pofloat1, pofloat2, pofloat3, pofloat4, PLATFORM_RATIO);
                }
                ii = ii + count;
                count = 0;
            }

        }

    }

    if (printQRbottom) {
        for (int jj = 1; jj < height + 2; jj++) //draw front
        {

            for (int ii = 1; ii < width + 2; ii++) {
                if (drawArray[ii][jj] == 1) {
                    while ((ii + count < width + 2) && (drawArray[ii + count][jj] == 1)) {
                        count++;
                    }

                    pofloat1[0] = (float) ii;
                    pofloat1[1] = (float) jj;
                    pofloat1[2] = PLATFORM_HEIGHT;

                    pofloat4[0] = (float) ii + 0.0f;
                    pofloat4[1] = (float) jj + 1.0f;
                    pofloat4[2] = PLATFORM_HEIGHT;

                    pofloat3[0] = (float) ii + count;//1.0f;
                    pofloat3[1] = (float) jj + 1.0f;
                    pofloat3[2] = PLATFORM_HEIGHT;

                    pofloat2[0] = (float) ii + count;//1.0f;
                    pofloat2[1] = (float) jj + 0.0f;
                    pofloat2[2] = PLATFORM_HEIGHT;

                    if (count != 0) {
                        drawer.drawFront(pofloat1, pofloat2, pofloat3, pofloat4, PLATFORM_RATIO);
                    }
                    ii = ii + count;
                    count = 0;
                }

            }

        }
    }

    drawer.resizeNumTriangles();

    System.out.println("STL drawn: " + filename + ".stl");
    drawer.closeFile();

}

From source file:com.rapidminer.gui.new_plotter.configuration.PlotConfiguration.java

public void setAxisLineColor(Color axisLineColor) {
    if (!axisLineColor.equals(this.axisLineColor)) {
        this.axisLineColor = axisLineColor;
        firePlotConfigurationChanged(new PlotConfigurationChangeEvent(this,
                PlotConfigurationChangeType.AXIS_LINE_COLOR, axisLineColor));
    }/*from  www .  j a va 2 s.c  o m*/
}

From source file:com.rapidminer.gui.new_plotter.configuration.PlotConfiguration.java

/**
 * @param backgroundColor//from   ww  w.  jav  a 2 s  .c o  m
 *            the backGroundColor to set
 */
public void setPlotBackgroundColor(Color backgroundColor) {
    if (!backgroundColor.equals(this.plotBackgroundColor)) {
        this.plotBackgroundColor = backgroundColor;
        firePlotBackgroundColorChanged();
    }
}

From source file:com.rapidminer.gui.new_plotter.configuration.PlotConfiguration.java

/**
 * @param frameBackgroundColor/*from  w  w w  . j ava2s .c o m*/
 *            the chartBackgroundColor to set
 */
public void setFrameBackgroundColor(Color frameBackgroundColor) {
    if (!frameBackgroundColor.equals(this.frameBackgroundColor)) {
        this.frameBackgroundColor = frameBackgroundColor;
        fireChartBackgroundChanged();
    }
}

From source file:com.rapidminer.gui.new_plotter.gui.ColorSchemeDialog.java

private void replaceSelectedColorAction() {
    Color oldColor = colorList.getSelectedValue();
    Color newSchemeColor = createColorDialog(oldColor);
    if (newSchemeColor != null && !newSchemeColor.equals(oldColor)) {
        replaceColorAction(newSchemeColor, oldColor);
        adaptPreviewPlots();//  ww  w . j a va 2 s . c om
    }
}