Example usage for java.awt Color Color

List of usage examples for java.awt Color Color

Introduction

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

Prototype

public Color(ColorSpace cspace, float[] components, float alpha) 

Source Link

Document

Creates a color in the specified ColorSpace with the color components specified in the float array and the specified alpha.

Usage

From source file:edu.ku.brc.util.CustomColorBarChartRenderer.java

/**
 * /*from  w w  w  .  j  a  v  a  2  s.c o  m*/
 */
public CustomColorBarChartRenderer() {
    colors = new Paint[rgb.length];
    for (int i = 0; i < rgb.length; i++) {
        colors[i / 3] = new Color(rgb[i], rgb[i + 1], rgb[i + 2]);
        i += 2;
    }
}

From source file:web.diva.server.model.JFreeImgGenerator.java

public Color hex2Rgb(String colorStr) {
    return new Color(Integer.valueOf(colorStr.substring(1, 3), 16),
            Integer.valueOf(colorStr.substring(3, 5), 16), Integer.valueOf(colorStr.substring(5, 7), 16));
}

From source file:org.jfree.chart.demo.Bottom_panel.java

/**
 * Create the panel./*from www.  j av  a2s .  c  o  m*/
 */
public Bottom_panel(ArrayList<Graphic> Grafs, ArrayList<XYSeries> series, int x, int y, int width, int height) {

    graf = Grafs.get(8);
    serie = series;
    setBounds(x, y, width, height);
    setLayout(new GridLayout(0, 4, 2, 0));
    final JCheckBox chckbxNewCheckBox_5 = new JCheckBox("Graph 1");
    chckbxNewCheckBox_5.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {

            XYSeries sr = serie.get(0);

            if (chckbxNewCheckBox_5.isSelected() == true) {

                graf.change_data(serie.get(0), true);
            } else {
                graf.change_data(serie.get(0), false);
            }
        }
    });
    chckbxNewCheckBox_5.setBackground(new Color(176, 199, 246));
    add(chckbxNewCheckBox_5);

    final JCheckBox chckbxNewCheckBox_1 = new JCheckBox("Graph2");
    chckbxNewCheckBox_1.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {

            XYSeries sr = serie.get(1);

            if (chckbxNewCheckBox_1.isSelected() == true) {

                graf.change_data(serie.get(1), true);
            } else {
                graf.change_data(serie.get(1), false);
            }
        }

    });
    chckbxNewCheckBox_1.setBackground(new Color(176, 199, 246));
    add(chckbxNewCheckBox_1);

    final JCheckBox chckbxNewCheckBox_2 = new JCheckBox("Graph 3");
    chckbxNewCheckBox_2.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {

            XYSeries sr = serie.get(2);

            if (chckbxNewCheckBox_2.isSelected() == true) {

                graf.change_data(serie.get(2), true);
            } else {
                graf.change_data(serie.get(2), false);
            }
        }

    });
    chckbxNewCheckBox_2.setBackground(new Color(176, 199, 246));
    add(chckbxNewCheckBox_2);

    final JCheckBox chckbxNewCheckBox = new JCheckBox("Graph 4");
    chckbxNewCheckBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {

            XYSeries sr = serie.get(3);

            if (chckbxNewCheckBox.isSelected() == true) {

                graf.change_data(serie.get(3), true);
            } else {
                graf.change_data(serie.get(3), false);
            }
        }

    });
    chckbxNewCheckBox.setBackground(new Color(176, 199, 246));
    add(chckbxNewCheckBox);

    final JCheckBox chckbxNewCheckBox_3 = new JCheckBox("Graph 5");
    chckbxNewCheckBox_3.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {

            XYSeries sr = serie.get(4);

            if (chckbxNewCheckBox_3.isSelected() == true) {

                graf.change_data(serie.get(4), true);
            } else {
                graf.change_data(serie.get(4), false);
            }
        }

    });
    chckbxNewCheckBox_3.setBackground(new Color(176, 199, 246));
    add(chckbxNewCheckBox_3);

    final JCheckBox chckbxNewCheckBox_4 = new JCheckBox("Graph 6");
    chckbxNewCheckBox_4.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {

            XYSeries sr = serie.get(5);

            if (chckbxNewCheckBox_4.isSelected() == true) {

                graf.change_data(serie.get(5), true);
            } else {
                graf.change_data(serie.get(5), false);
            }
        }
    });
    chckbxNewCheckBox_4.setBackground(new Color(176, 199, 246));
    add(chckbxNewCheckBox_4);

    final JCheckBox chckbxNewCheckBox_6 = new JCheckBox("Graph 7");
    chckbxNewCheckBox_6.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {

            XYSeries sr = serie.get(6);

            if (chckbxNewCheckBox_6.isSelected() == true) {

                graf.change_data(serie.get(6), true);
            } else {
                graf.change_data(serie.get(6), false);
            }
        }

    });
    chckbxNewCheckBox_6.setBackground(new Color(176, 199, 246));
    add(chckbxNewCheckBox_6);

    final JCheckBox chckbxNewCheckBox_7 = new JCheckBox("Graph 8");
    chckbxNewCheckBox_7.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {

            XYSeries sr = serie.get(7);

            if (chckbxNewCheckBox_6.isSelected() == true) {

                graf.change_data(serie.get(7), true);
            } else {
                graf.change_data(serie.get(7), false);
            }
        }

    });
    chckbxNewCheckBox_7.setBackground(new Color(176, 199, 246));
    add(chckbxNewCheckBox_7);

}

From source file:analisisnumerico.Main.java

public Main() {
    setTitle("Analisis Numerico");
    setBounds(145, 80, 780, 480);/* w ww .j  av a 2s  .  c o  m*/
    this.setUndecorated(true);
    initComponents();
    jPanel2.setBackground(new Color(219, 68, 55));
    JLabel text = new JLabel("Analisis Numerico");
    text.setBounds(14, 0, 160, 40);
    text.setForeground(Color.WHITE);
    jPanel2.add(text);
    jButton1.setSize(20, 20);
    jButton2.setSize(20, 20);
    Fondo f = new Fondo();
    jPanel1.add(f);
    m.setBounds(0, 0, 780, 480);
    f.add(m);
    jButton2.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            setExtendedState(ICONIFIED);
        }
    });
    jButton2.setVisible(true);
    jButton1.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            System.exit(0);
        }
    });
    jButton1.setVisible(true);

    jButton6.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            Biseccion s = new Biseccion(F);
            f.removeAll();
            s.setBounds(0, 0, 780, 480);
            f.add(s);
            f.setVisible(true);
            f.updateUI();
        }
    });

    jButton7.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            Secante s = new Secante(F);
            f.removeAll();
            s.setBounds(0, 0, 780, 480);
            f.add(s);
            f.setVisible(true);
            f.updateUI();
        }
    });

    jButton3.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            Menu m = new Menu(F);
            f.removeAll();
            m.setBounds(0, 0, 780, 480);
            f.add(m);
            f.setVisible(true);
            f.updateUI();
        }
    });

    jButton8.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            Newton n = new Newton(F);
            f.removeAll();
            n.setBounds(0, 0, 780, 480);
            f.add(n);
            f.setVisible(true);
            f.updateUI();
        }
    });
    jButton5.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            Grafica g = new Grafica(F);
            f.removeAll();
            g.setBounds(0, 0, 780, 480);
            f.add(g);
            f.setVisible(true);
            f.updateUI();

        }
    });
    jButton4.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            SistemasEcuaciones m = new SistemasEcuaciones();
            f.removeAll();
            m.setBounds(0, 0, 780, 480);
            f.add(m);
            f.setVisible(true);
            f.updateUI();
        }
    });
}

From source file:ColorsBeanInfo.java

private Color randomColor() {
        int r = (int) (255 * Math.random());
        int g = (int) (255 * Math.random());
        int b = (int) (255 * Math.random());
        return new Color(r, g, b);
    }//from  w  w w  . j a v a 2  s  .co m

From source file:game.rushhour.carmodel.CarModel.java

public Color getColor() {
    return new Color(getRed(), getGreen(), getBlue());
}

From source file:ColorGradient.java

/** Draw the applet. The interesting code is in fillGradient() below */
public void paint(Graphics g) {
    fillGradient(this, g, startColor, endColor); // display the gradient
    g.setFont(bigFont); // set a font
    g.setColor(new Color(100, 100, 200)); // light blue
    g.drawString("Colors!", 100, 100); // draw something interesting
}

From source file:org.jfree.chart.demo.StackedXYBarChartDemo3.java

private static JFreeChart createChart(TableXYDataset tablexydataset) {
    DateAxis dateaxis = new DateAxis("Year");
    dateaxis.setTickMarkPosition(DateTickMarkPosition.MIDDLE);
    dateaxis.setLowerMargin(0.01D);/* w  w  w. j av  a 2s  .co  m*/
    dateaxis.setUpperMargin(0.01D);
    NumberAxis numberaxis = new NumberAxis("Tonnes");
    numberaxis.setNumberFormatOverride(new DecimalFormat("0.0%"));
    StackedXYBarRenderer stackedxybarrenderer = new StackedXYBarRenderer(0.29999999999999999D);
    stackedxybarrenderer.setRenderAsPercentages(true);
    GradientPaint gradientpaint = new GradientPaint(0.0F, 0.0F, new Color(64, 0, 0), 0.0F, 0.0F, Color.red);
    GradientPaint gradientpaint1 = new GradientPaint(0.0F, 0.0F, new Color(0, 64, 0), 0.0F, 0.0F, Color.green);
    stackedxybarrenderer.setSeriesPaint(0, gradientpaint);
    stackedxybarrenderer.setSeriesPaint(1, gradientpaint1);
    stackedxybarrenderer.setGradientPaintTransformer(
            new StandardGradientPaintTransformer(GradientPaintTransformType.HORIZONTAL));
    stackedxybarrenderer.setDrawBarOutline(false);
    stackedxybarrenderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator("{0} : {1} = {2} tonnes",
            new SimpleDateFormat("yyyy"), new DecimalFormat("#,##0")));
    XYPlot xyplot = new XYPlot(tablexydataset, dateaxis, numberaxis, stackedxybarrenderer);
    xyplot.setBackgroundPaint(Color.lightGray);
    xyplot.setDomainGridlinePaint(Color.white);
    xyplot.setRangeGridlinePaint(Color.white);
    JFreeChart jfreechart = new JFreeChart("Waste Management", xyplot);
    jfreechart.setBackgroundPaint(Color.white);
    jfreechart.addSubtitle(new TextTitle("St Albans City and District Council"));
    return jfreechart;
}

From source file:com.baidu.rigel.biplatform.ma.auth.resource.RandomValidateCode.java

private static Color getRandColor(int fc, int bc) {
    final int baseNum = 255;
    if (fc > baseNum) {
        fc = baseNum;/*from  w w  w .ja v  a  2s .c om*/
    }
    if (bc > baseNum) {
        bc = baseNum;
    }
    int r = fc + random.nextInt(bc - fc - 16);
    int g = fc + random.nextInt(bc - fc - 14);
    int b = fc + random.nextInt(bc - fc - 18);
    return new Color(r, g, b);
}

From source file:coolmap.application.widget.impl.console.WidgetConsole.java

public WidgetConsole() {
    super("Console", W_DATA, L_DATAPORT, UI.getImageIcon("console"), "Displays console information");
    getContentPane().setLayout(new BorderLayout());
    getContentPane().add(_container, BorderLayout.CENTER);
    _container.setLayout(new BorderLayout());
    _container.add(new JScrollPane(consolePane), BorderLayout.CENTER);

    ///*from ww  w  .j  ava 2 s.  com*/
    consolePane.setFont(UI.fontMono.deriveFont(12f));
    consolePane.setBackground(new Color(255, 255, 204));

    //        for (int i = 0; i < 100; i++) {
    //            logError("abcdefgh\n");
    //            logInfo("ABCDEFGH\n");
    //            log("DEFGHIJKL\n");
    //        }
    JPopupMenu popupMenu = new JPopupMenu();
    consolePane.setComponentPopupMenu(popupMenu);
    JMenuItem item = new JMenuItem("Clear", UI.getImageIcon("trashBin"));
    item.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            consolePane.setText("");
        }
    });
    popupMenu.add(item);
}