Example usage for java.awt Color green

List of usage examples for java.awt Color green

Introduction

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

Prototype

Color green

To view the source code for java.awt Color green.

Click Source Link

Document

The color green.

Usage

From source file:SVGJUnitTest.java

public void paint2(Graphics2D g2d) {

    g2d.setPaint(Color.green);
    g2d.fill(new Rectangle(90, 90, 100, 100));
}

From source file:net.sf.jclal.gui.view.components.chart.ExternalBasicChart.java

private JFreeChart createChart(XYDataset dataset, String title, String xTitle, String yTitle) {

    colors.add(Color.BLACK);//ww  w  .  j  a v  a2  s .c  o  m
    colors.add(1, Color.BLUE);
    colors.add(1, Color.RED);
    colors.add(1, Color.GREEN);
    colors.add(1, Color.YELLOW);
    colors.add(1, Color.CYAN);
    colors.add(1, Color.MAGENTA);
    colors.add(1, new Color(111, 83, 64));
    colors.add(1, new Color(153, 51, 255));
    colors.add(1, new Color(102, 204, 255));
    colors.add(1, new Color(85, 80, 126));
    colors.add(1, new Color(168, 80, 126));

    chart = ChartFactory.createXYLineChart(title, xTitle, yTitle, dataset, PlotOrientation.VERTICAL, true, true,
            false);

    chart.setBackgroundPaint(Color.white);

    chart.getXYPlot().setBackgroundPaint(Color.white);
    chart.getXYPlot().setDomainGridlinePaint(Color.white);
    chart.getXYPlot().setRangeGridlinePaint(Color.white);

    int numSeries = series.getSeriesCount();

    XYLineAndShapeRenderer renderer = ((XYLineAndShapeRenderer) chart.getXYPlot().getRenderer());

    renderer.setDrawSeriesLineAsPath(true);

    renderer.setSeriesStroke(0, new BasicStroke(2.0F));

    renderer.setSeriesStroke(1,
            new BasicStroke(2.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 1.0f, new float[] { 2 }, 0));

    renderer.setSeriesStroke(2, new BasicStroke(2.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 1.0f,
            new float[] { 6.0f, 2.0f, 6.0f, 2.0f }, 0.0f));

    renderer.setSeriesStroke(3, new BasicStroke(2.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 1.0f,
            new float[] { 12.0f, 2.0f, 2.0f, 2.0f }, 0.0f));

    renderer.setSeriesStroke(4, new BasicStroke(2.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 1.0f,
            new float[] { 12.0f, 2.0f, 2.0f, 2.0f, 2.0f, 2.0f }, 0.0f));

    renderer.setSeriesStroke(5, new BasicStroke(2.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 1.0f,
            new float[] { 12, 2, 12, 2, 2, 2, 2, 2, 2, 2, 2, 2 }, 0));

    renderer.setSeriesStroke(6, new BasicStroke(2.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 1.0f,
            new float[] { 6.0f, 2.0f, 6.0f, 2.0f, 2.0f, 2.0f }, 0.0f));

    renderer.setSeriesStroke(7, new BasicStroke(2.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 1.0f,
            new float[] { 6.0f, 2.0f, 6.0f, 2.0f, 6.0f, 2.0f, 2.0f, 2.0f, 2.0f, 2.0f, 2.0f, 2.0f }, 0.0f));

    for (int i = 0; i < numSeries; i++) {

        if (i == colors.size()) {

            colors = addColors(colors, numSeries);

        }

        if (viewWithOutColor) {
            renderer.setSeriesPaint(i, Color.BLACK);
        } else {
            String name = series.getSeries(i).getKey().toString();

            if (!controlCurveColor.containsKey(name)) {
                renderer.setSeriesPaint(i, colors.get(i));
                controlCurveColor.put(name, colors.get(i));

            } else {

                renderer.setSeriesPaint(i, controlCurveColor.get(name));

            }

            renderer.setSeriesShapesVisible(i, viewPointsForm);

            if (viewWhiteBackground) {
                chart.getXYPlot().setBackgroundPaint(Color.WHITE);
            }
        }
    }
    chart.getXYPlot().setRenderer(renderer);

    return chart;
}

From source file:org.zaproxy.zap.extension.customFire.ScanProgressDialog.java

/**
 * /*from   ww w  .ja va2s.  c om*/
 */
private void initialize() {
    this.setSize(new Dimension(580, 504));

    if (site != null) {

        this.setTitle("Scann Progress");

    }

    JTabbedPane tabbedPane = new JTabbedPane();
    JPanel tab1 = new JPanel();
    tab1.setLayout(new GridBagLayout());

    JPanel hostPanel = new JPanel();

    hostPanel.setLayout(new GridBagLayout());

    hostPanel.add(new JLabel("Host:"), LayoutHelper.getGBC(0, 0, 1, 0.4D));

    hostPanel.add(getHostSelect(), LayoutHelper.getGBC(1, 0, 1, 0.6D));

    tab1.add(hostPanel, LayoutHelper.getGBC(0, 0, 3, 1.0D, 0.0D));

    tab1.add(getJScrollPane(), LayoutHelper.getGBC(0, 1, 3, 1.0D, 1.0D));//*

    tab1.add(new JLabel(), LayoutHelper.getGBC(0, 1, 1, 1.0D, 0.0D)); // spacer
    tab1.add(getCloseButton(), LayoutHelper.getGBC(1, 2, 1, 0.0D, 0.0D));

    tab1.add(new JLabel(), LayoutHelper.getGBC(2, 1, 1, 1.0D, 0.0D)); // spacer

    tabbedPane.insertTab("Progress", null, tab1, null, 0);
    this.add(tabbedPane);

    int mins = extension.getScannerParam().getMaxChartTimeInMins();
    if (mins > 0) {
        // Treat zero mins as disabled

        JPanel tab2 = new JPanel();

        tab2.setLayout(new GridBagLayout());

        this.seriesTotal = new TimeSeries("TotalResponses"); // Name not shown, so no need to i18n
        final TimeSeriesCollection dataset = new TimeSeriesCollection(this.seriesTotal);

        this.series100 = new TimeSeries("1xx");
        this.series200 = new TimeSeries("2xx");
        this.series300 = new TimeSeries("3xx");
        this.series400 = new TimeSeries("4xx");
        this.series500 = new TimeSeries("5xx");

        this.seriesTotal.setMaximumItemAge(mins * 60);
        this.series100.setMaximumItemAge(mins * 60);
        this.series200.setMaximumItemAge(mins * 60);
        this.series300.setMaximumItemAge(mins * 60);
        this.series400.setMaximumItemAge(mins * 60);
        this.series500.setMaximumItemAge(mins * 60);

        dataset.addSeries(series100);
        dataset.addSeries(series200);
        dataset.addSeries(series300);
        dataset.addSeries(series400);
        dataset.addSeries(series500);

        chart = createChart(dataset);//*

        // Set up some vaguesly sensible colours
        chart.getXYPlot().getRenderer(0).setSeriesPaint(0, Color.BLACK); // Totals
        chart.getXYPlot().getRenderer(0).setSeriesPaint(1, Color.ORANGE); // 100: Info
        chart.getXYPlot().getRenderer(0).setSeriesPaint(2, Color.GREEN); // 200: OK
        chart.getXYPlot().getRenderer(0).setSeriesPaint(3, Color.BLUE); // 300: Info
        chart.getXYPlot().getRenderer(0).setSeriesPaint(4, Color.YELLOW); // 400: Bad req
        chart.getXYPlot().getRenderer(0).setSeriesPaint(5, Color.RED); // 500: Internal error

        chart.getXYPlot().getRenderer(0).setSeriesStroke(0, new BasicStroke(5.0f)); // Totals
        chart.getXYPlot().getRenderer(0).setSeriesStroke(0, new BasicStroke(3.0f)); // 100: Info
        chart.getXYPlot().getRenderer(0).setSeriesStroke(0, new BasicStroke(3.0f)); // 200: OK
        chart.getXYPlot().getRenderer(0).setSeriesStroke(0, new BasicStroke(3.0f)); // 300: Info
        chart.getXYPlot().getRenderer(0).setSeriesStroke(0, new BasicStroke(3.0f)); // 400: Bad req
        chart.getXYPlot().getRenderer(0).setSeriesStroke(0, new BasicStroke(3.0f)); // 500: Internal error

        final ChartPanel chartPanel = new ChartPanel(chart);

        tab2.add(chartPanel, LayoutHelper.getGBC(0, 0, 1, 1.0D, 1.0D));

        tabbedPane.insertTab("ResponseCharts", null, tab2, null, 1);

    }

    // Stop the updating thread when the window is closed
    this.addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosed(WindowEvent e) {
            stopThread = true;
        }
    });

}

From source file:org.tsho.dmc2.core.chart.CyclesRenderer.java

private void checkStability(double cycleModulus[], Graphics2D g2) {
    /*check eigval modulus. Depending on it, set color.*/
    boolean stable = false;
    boolean unstable = false;
    boolean one = false;
    int dim = cycleModulus.length;
    for (int i = 0; i < dim; i++) {
        if (stable)
            if (cycleModulus[i] >= 1) {
                stable = false;/*from w ww  . j ava2  s .c  o m*/
                break;
            } else
                continue;
        if (unstable)
            if (cycleModulus[i] <= 1) {
                unstable = false;
                break;
            } else
                continue;
        if (Math.abs(cycleModulus[i] - 1) <= epsilon) {
            one = true;
            break;
        } else if (cycleModulus[i] < 1)
            stable = true;
        else if (cycleModulus[i] > 1)
            unstable = true;
        else
            break;
    }
    if (one)
        g2.setColor(Color.BLACK);
    else if (stable)
        g2.setColor(Color.GREEN);
    else if (unstable)
        g2.setColor(Color.RED);
    else
        g2.setColor(Color.BLUE);
}

From source file:edu.clemson.cs.nestbed.client.gui.MoteManagementPanel.java

public void paintComponent(Graphics g) {
    super.paintComponent(g);

    if (moteDepConfig == null) {
        paintDisabledPattern(g);/*  w w w  .  ja  v  a 2 s .  c o  m*/
    } else if (drawBorder) {
        Color oldColor = g.getColor();
        Color newColor = (installedSuccessfully || (installAnimationThread != null)) ? Color.green : Color.red;
        int arcSize = 4;

        g.setColor(newColor);
        g.drawRoundRect(0, 0, getWidth() - 1, getHeight() - 1, arcSize, arcSize);
        g.setColor(oldColor);
    }
}

From source file:ExposedFloat.java

public void init() {

    Panel buttonPanel = new PanelWithInsets(0, 0, 0, 0);
    buttonPanel.setLayout(new GridLayout(6, 2, 5, 5));
    buttonPanel.add(maximumButton);//from  w  ww .  j ava2  s .c  o m
    buttonPanel.add(minimumButton);
    buttonPanel.add(positiveInfinityButton);
    buttonPanel.add(negativeInfinityButton);
    buttonPanel.add(piButton);
    buttonPanel.add(notANumberButton);
    buttonPanel.add(new Button(multByZeroButtonString));
    buttonPanel.add(new Button(changeSignButtonString));
    buttonPanel.add(new Button(doubleButtonString));
    buttonPanel.add(new Button(halveButtonString));
    buttonPanel.add(new RepeaterButton(incrementButtonString));
    buttonPanel.add(new RepeaterButton(decrementButtonString));

    binaryField = new Label("00000000000000000000000000000000");
    signField = new Label("0");
    exponentField = new Label("00000000");
    mantissaField = new Label("000000000000000000000000");
    hexField = new Label("00000000");
    base2Field = new Label("0");
    base10Field = new Label("0");

    Font fieldFont = new Font("TimesRoman", Font.PLAIN, 12);
    binaryField.setFont(fieldFont);
    signField.setFont(fieldFont);
    exponentField.setFont(fieldFont);
    mantissaField.setFont(fieldFont);
    hexField.setFont(fieldFont);
    base2Field.setFont(fieldFont);
    base10Field.setFont(fieldFont);

    Panel numberPanel = new Panel();
    numberPanel.setBackground(Color.white);
    numberPanel.setLayout(new GridLayout(7, 1));
    numberPanel.add(signField);
    numberPanel.add(exponentField);
    numberPanel.add(mantissaField);
    Panel binaryPanel = new Panel();
    binaryPanel.setLayout(new BorderLayout());
    binaryPanel.add("Center", binaryField);
    numberPanel.add(binaryPanel);

    Panel hexPanel = new Panel();
    hexPanel.setLayout(new BorderLayout());
    hexPanel.add("Center", hexField);
    numberPanel.add(hexPanel);
    numberPanel.add(base2Field);
    numberPanel.add(base10Field);

    Panel labelPanel = new Panel();
    labelPanel.setBackground(Color.white);
    labelPanel.setLayout(new GridLayout(7, 1));
    Font labelFont = new Font("Helvetica", Font.ITALIC, 11);
    Label label = new Label(signString, Label.CENTER);
    label.setFont(labelFont);
    labelPanel.add(label);
    label = new Label(exponentString, Label.CENTER);
    label.setFont(labelFont);
    labelPanel.add(label);
    label = new Label(mantissaString, Label.CENTER);
    label.setFont(labelFont);
    labelPanel.add(label);
    label = new Label(binaryString, Label.CENTER);
    label.setFont(labelFont);
    labelPanel.add(label);
    label = new Label(hexString, Label.CENTER);
    label.setFont(labelFont);
    labelPanel.add(label);
    label = new Label(base2String, Label.CENTER);
    label.setFont(labelFont);
    labelPanel.add(label);
    label = new Label(base10String, Label.CENTER);
    label.setFont(labelFont);
    labelPanel.add(label);

    Panel dataPanel = new Panel();
    dataPanel.setLayout(new BorderLayout());
    dataPanel.add("West", labelPanel);
    dataPanel.add("Center", numberPanel);

    ColoredLabel title = new ColoredLabel(titleString, Label.CENTER, Color.cyan);
    title.setFont(new Font("Helvetica", Font.BOLD, 12));

    setBackground(Color.green);
    setLayout(new BorderLayout(5, 5));
    add("North", title);
    add("West", buttonPanel);
    add("Center", dataPanel);
}

From source file:i2p.bote.web.PeerInfoTag.java

private String createDhtChart(DhtPeerStats dhtStats) throws IOException {
    RingPlot plot;//from  w  ww . j av a 2  s  . c  o m
    int numDhtPeers = dhtStats.getData().size();
    if (numDhtPeers == 0) {
        DefaultPieDataset dataset = new DefaultPieDataset();
        dataset.setValue("", 100);

        plot = new RingPlot(dataset);
        plot.setSectionPaint("", Color.gray);
    } else {
        int reachable = 0;
        for (List<String> row : dhtStats.getData()) {
            if (_t("No").equals(row.get(4)))
                reachable += 1;
        }
        int unreachable = numDhtPeers - reachable;

        DefaultPieDataset dataset = new DefaultPieDataset();
        if (reachable > 0)
            dataset.setValue(_t("Reachable"), reachable);
        if (unreachable > 0)
            dataset.setValue(_t("Unreachable"), unreachable);

        plot = new RingPlot(dataset);
        plot.setSectionPaint(_t("Reachable"), Color.green);
        plot.setSectionPaint(_t("Unreachable"), Color.red);
    }
    plot.setLabelGenerator(null);
    plot.setShadowGenerator(null);

    JFreeChart dhtChart = new JFreeChart(_t("Kademlia Peers:"), JFreeChart.DEFAULT_TITLE_FONT, plot,
            numDhtPeers == 0 ? false : true);
    return ServletUtilities.saveChartAsPNG(dhtChart, 400, 300, null);
}

From source file:umontreal.iro.lecuyer.charts.SSJCategorySeriesCollection.java

protected static Color getDefaultColor(int index) {
    if (index % 6 == 0)
        return Color.RED;
    else if (index % 6 == 1)
        return Color.BLUE;
    else if (index % 6 == 2)
        return Color.GREEN;
    else if (index % 6 == 3)
        return Color.YELLOW;
    else if (index % 6 == 4)
        return Color.MAGENTA;
    else//from   w  w w .java 2 s.  c  om
        return Color.CYAN;
}

From source file:no.uio.medicine.virsurveillance.charts.StackedChart_AWT.java

private Color getColor(int index) {
    int index2 = index + this.colorOffset;
    switch (index2) {
    case 0://from   w ww.  java2s.  co  m
        return Color.RED;
    case 1:
        return Color.BLUE;
    case 2:
        return Color.GREEN;
    case 3:
        return Color.YELLOW;
    case 4:
        return Color.DARK_GRAY;
    case 5:
        return Color.ORANGE;
    case 6:
        return Color.BLACK;
    case 7:
        return Color.CYAN;
    case 8:
        return Color.GRAY;
    case 9:
        return Color.LIGHT_GRAY;
    case 10:
        return Color.MAGENTA;
    case 11:
        return Color.PINK;
    case 12:
        return Color.WHITE;
    default:
        return getColor((int) Math.floor(Math.random() * 14));
    }

}

From source file:j2se.jfreechart.barchart.BarChartDemo7.java

/**
 * Creates a sample chart.//from  w ww. j a v  a  2  s.c om
 * 
 * @param dataset  the dataset.
 * 
 * @return The chart.
 */
private JFreeChart createChart(final CategoryDataset dataset) {

    // create the chart...
    final JFreeChart chart = ChartFactory.createBarChart("Bar Chart Demo 7", // chart title
            "Category", // domain axis label
            "Value", // range axis label
            dataset, // data
            PlotOrientation.VERTICAL, // orientation
            false, // include legend
            true, // tooltips?
            false // URLs?
    );

    // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...

    // set the background color for the chart...
    chart.setBackgroundPaint(Color.white);

    // get a reference to the plot for further customisation...
    final CategoryPlot plot = chart.getCategoryPlot();
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);

    final IntervalMarker target = new IntervalMarker(4.5, 7.5);
    target.setLabel("Target Range");
    target.setLabelFont(new Font("SansSerif", Font.ITALIC, 11));
    target.setLabelAnchor(RectangleAnchor.LEFT);
    target.setLabelTextAnchor(TextAnchor.CENTER_LEFT);
    target.setPaint(new Color(222, 222, 255, 128));
    plot.addRangeMarker(target, Layer.BACKGROUND);

    // set the range axis to display integers only...
    final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    // disable bar outlines...
    final BarRenderer renderer = (BarRenderer) plot.getRenderer();
    renderer.setDrawBarOutline(false);
    renderer.setItemMargin(0.10);

    // set up gradient paints for series...
    final GradientPaint gp0 = new GradientPaint(0.0f, 0.0f, Color.blue, 0.0f, 0.0f, Color.lightGray);
    final GradientPaint gp1 = new GradientPaint(0.0f, 0.0f, Color.green, 0.0f, 0.0f, Color.lightGray);
    final GradientPaint gp2 = new GradientPaint(0.0f, 0.0f, Color.red, 0.0f, 0.0f, Color.lightGray);
    renderer.setSeriesPaint(0, gp0);
    renderer.setSeriesPaint(1, gp1);
    renderer.setSeriesPaint(2, gp2);

    //      renderer.setLabelGenerator(new BarChartDemo7.LabelGenerator());
    renderer.setItemLabelsVisible(true);
    final ItemLabelPosition p = new ItemLabelPosition(ItemLabelAnchor.INSIDE12, TextAnchor.CENTER_RIGHT,
            TextAnchor.CENTER_RIGHT, -Math.PI / 2.0);
    renderer.setPositiveItemLabelPosition(p);

    final ItemLabelPosition p2 = new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.CENTER_LEFT,
            TextAnchor.CENTER_LEFT, -Math.PI / 2.0);
    renderer.setPositiveItemLabelPositionFallback(p2);
    final CategoryAxis domainAxis = plot.getDomainAxis();
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);
    // OPTIONAL CUSTOMISATION COMPLETED.

    return chart;

}