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:org.openscience.cdk.applications.taverna.basicutilities.ChartTool.java

/**
 * Creates a bar chart./*  ww  w .j  av  a  2s .  c o m*/
 * 
 * @param title
 * @param categoryAxisLabel
 *            (X-Axis label)
 * @param valueAxisLabel
 *            (Y-Axis label)
 * @param dataset
 * @return JfreeChart instance.
 */
public JFreeChart createBarChart(String title, String categoryAxisLabel, String valueAxisLabel,
        CategoryDataset dataset) {
    JFreeChart chart = ChartFactory.createBarChart(title, categoryAxisLabel, valueAxisLabel, dataset,
            this.orientation, this.drawLegend, false, false);
    // set the background color for the chart...
    chart.setBackgroundPaint(Color.white);
    chart.setAntiAlias(true);
    CategoryPlot plot = chart.getCategoryPlot();
    CategoryAxis domainAxis = plot.getDomainAxis();
    domainAxis.setLowerMargin(0.01);
    domainAxis.setUpperMargin(0.01);
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.DOWN_90);
    BarRenderer renderer = (BarRenderer) plot.getRenderer();
    renderer.setSeriesPaint(0, Color.blue);
    renderer.setSeriesPaint(1, Color.red);
    renderer.setSeriesPaint(2, Color.green);
    renderer.setSeriesPaint(3, Color.darkGray);
    renderer.setSeriesPaint(4, Color.yellow);
    return chart;
}

From source file:vis2006.VisGrafik.java

public JFreeChart createChart(Stand st, int speciesCode) {
    // create the dataset...
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();

    // Durchmesserhufigkeiten in 5-cm-Klassen bestimmen (Klassenmitten: 7.5 bis max. 152.5)
    for (int i = 0; i < 30; i++) {
        for (int j = 0; j < 3; j++) {
            double anz = 0;
            double gesamtZahl = 0;
            for (int k = 0; k < st.ntrees; k++) {
                if (speciesCode == st.tr[k].code && st.tr[k].fac > 0.0) {
                    if ((st.tr[k].d > i * 5) && (st.tr[k].d <= (i + 1) * 5))
                        gesamtZahl = gesamtZahl + st.tr[k].fac;
                    if ((j == 2) && (st.tr[k].d > i * 5) && (st.tr[k].d <= (i + 1) * 5) && (st.tr[k].out < 0)
                            && (st.tr[k].crop == true))
                        anz = anz + st.tr[k].fac;
                    if ((j == 0) && (st.tr[k].d > i * 5) && (st.tr[k].d <= (i + 1) * 5) && (st.tr[k].out < 0)
                            && (st.tr[k].crop == false))
                        anz = anz + st.tr[k].fac;
                    if ((j == 1) && (st.tr[k].d > i * 5) && (st.tr[k].d <= (i + 1) * 5) && (st.tr[k].out > 0))
                        anz = anz + st.tr[k].fac;
                }//from   w w  w.  jav  a  2s .c om
            }
            if (gesamtZahl > 0) {
                Integer m = (5 * i) + 2;
                String textcode = "";
                if (j == 0)
                    textcode = "verbleibend";
                if (j == 1)
                    textcode = "ausscheidend";
                if (j == 2)
                    textcode = "Z-Bume";
                dataset.addValue(anz / st.size, // Anzahl pro ha
                        textcode, // Gruppe
                        m.toString() + ".5"); // Durchmesserklassenmitte

            }
        }
    }

    //     
    JFreeChart chart = ChartFactory.createStackedBarChart(messages.getString("diameterDistribution"), // chart title
            messages.getString("dbhClass"), // domain axis label
            messages.getString("numberOfStems"), // range axis label
            dataset, // data
            PlotOrientation.VERTICAL, // orientation
            true, // include legend
            true, // tooltips?
            false // URLs?
    );
    CategoryPlot plot = chart.getCategoryPlot();
    //     plot.setBackgroundPaint(Color.lightGray);
    //     plot.setDomainGridlinePaint(Color.white);
    //     plot.setDomainGridlinesVisible(true);
    //     plot.setRangeGridlinePaint(Color.white);
    // reenderer
    StackedBarRenderer renderer = (StackedBarRenderer) plot.getRenderer();
    renderer.setDrawBarOutline(false);
    // set up gradient paints for series...
    renderer.setSeriesPaint(0, Color.GREEN);
    renderer.setSeriesPaint(1, Color.RED);
    renderer.setSeriesPaint(2, Color.BLUE);
    //renderer.setMaxBarWidth(0.15);
    renderer.setMaximumBarWidth(0.15);

    if (dataset.getColumnCount() > 10) {
        CategoryAxis xAxis = (CategoryAxis) plot.getDomainAxis();
        if (dataset.getColumnCount() < 21)
            xAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);
        else
            xAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
    }

    return chart;
}

From source file:vista.DestinosMasConsultados.java

public void iniciarGraficos(CategoryDataset dataset) {
    // create the chart...
    final JFreeChart chart = ChartFactory.createBarChart("Paises mas consultados", // chart title
            "Paises", // domain axis label
            "Cantidad de consultas", // range axis label
            dataset, // data
            PlotOrientation.VERTICAL, // orientation
            true, // include legend
            true, // tooltips?
            false // URLs?
    );//from ww  w.ja va  2s.  co m

    // 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);

    // 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);

    // 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);

    final CategoryAxis domainAxis = plot.getDomainAxis();
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 6.0));

    ChartPanel chartFinal = new ChartPanel(chart);
    chartFinal.setSize(new Dimension(600, 400));

    javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(panelDestinosMasConsultados);
    panelDestinosMasConsultados.setLayout(jPanel1Layout);
    jPanel1Layout
            .setHorizontalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup().addGap(0, 0, 0).addComponent(chartFinal)
                            .addContainerGap(0, Short.MAX_VALUE)));
    jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup().addGap(0, 0, 0).addComponent(chartFinal)
                    .addContainerGap(0, Short.MAX_VALUE)));

}

From source file:cn.InstFS.wkr.NetworkMining.UIs.TimeSeriesChart1.java

public static JFreeChart createChart2(ArrayList<DataItems> _nor_model, ArrayList<DataItems> _abnor_model,
        DataItems nor, DataItems abnor, Map<String, ArrayList<LinePos>> mapAB, String chartname,
        String protocol1, String protocol2) {
    XYDataset xydataset = createNormalDataset(nor, protocol1);
    JFreeChart jfreechart = ChartFactory.createXYLineChart(chartname, "", "", xydataset);
    jfreechart.getLegend().setVisible(false);
    XYPlot xyplot = (XYPlot) jfreechart.getPlot();
    NumberAxis numberaxis = (NumberAxis) xyplot.getRangeAxis();
    numberaxis.setAutoRangeIncludesZero(false);
    java.awt.geom.Ellipse2D.Double double1 = new java.awt.geom.Ellipse2D.Double(-4D, -4D, 6D, 6D);

    XYLineAndShapeRenderer xylineandshaperenderer = (XYLineAndShapeRenderer) xyplot.getRenderer();
    // ??//  w w w.  ja  va 2s . c  o  m
    xylineandshaperenderer.setSeriesLinesVisible(0, true);
    xylineandshaperenderer.setBaseShapesVisible(false);
    xylineandshaperenderer.setSeriesShape(0, double1);
    xylineandshaperenderer.setSeriesPaint(0, Color.blue);
    xylineandshaperenderer.setSeriesFillPaint(0, Color.blue);
    xylineandshaperenderer.setSeriesOutlinePaint(0, Color.blue);
    xylineandshaperenderer.setSeriesStroke(0, new BasicStroke(0.5F));
    // ?
    // xylineandshaperenderer.setBaseItemLabelGenerator(new
    // StandardXYItemLabelGenerator());
    // xylineandshaperenderer.setBaseItemLabelsVisible(true);
    int datasetcount0 = xyplot.getDatasetCount();

    XYDataset xydataset1 = createNormalDataset(abnor, protocol2);
    // xydataset1.
    XYLineAndShapeRenderer xylineandshaperenderer1 = new XYLineAndShapeRenderer();
    int datasetcount = xyplot.getDatasetCount();
    xyplot.setDataset(datasetcount, xydataset1);
    xyplot.setRenderer(datasetcount, xylineandshaperenderer1);
    // ???
    xylineandshaperenderer1.setBaseShapesVisible(false);
    // ??
    xylineandshaperenderer1.setSeriesLinesVisible(0, true);
    xylineandshaperenderer1.setSeriesShape(0, double1);
    // 
    xylineandshaperenderer1.setSeriesPaint(0, Color.green);
    xylineandshaperenderer1.setSeriesFillPaint(0, Color.green);
    xylineandshaperenderer1.setSeriesOutlinePaint(0, Color.green);
    xylineandshaperenderer1.setUseFillPaint(true);

    xylineandshaperenderer1.setBaseItemLabelGenerator(new StandardXYItemLabelGenerator());
    xylineandshaperenderer1.setSeriesStroke(0, new BasicStroke(0.5F));

    // //?
    /*
     * for (int i = 0; i < _nor_model.size(); i++) { XYDataset xydataset2 =
     * createmodeDataset(_nor_model.get(i), "_nor_model" + i);
     * XYLineAndShapeRenderer xylineandshaperenderer2 = new
     * XYLineAndShapeRenderer(); xyplot.setDataset(i + 2, xydataset2);
     * xyplot.setRenderer(2 + i, xylineandshaperenderer2); // ???
     * xylineandshaperenderer2.setBaseShapesVisible(false); // ??
     * xylineandshaperenderer2.setSeriesLinesVisible(0, true);
     * xylineandshaperenderer2.setSeriesShape(0, double1); // 
     * xylineandshaperenderer2.setSeriesPaint(0, Color.red);
     * xylineandshaperenderer2.setSeriesFillPaint(0, Color.red);
     * xylineandshaperenderer2.setSeriesOutlinePaint(0, Color.red);
     * xylineandshaperenderer2.setUseFillPaint(true);
     * xylineandshaperenderer2 .setBaseItemLabelGenerator(new
     * StandardXYItemLabelGenerator());
     * xylineandshaperenderer2.setSeriesStroke(0, new BasicStroke(2.5F));
     * 
     * } for (int i = 0; i < _abnor_model.size(); i++) { XYDataset
     * xydataset3 = createmodeDataset(_abnor_model.get(i), "_abnor_model" +
     * i); XYLineAndShapeRenderer xylineandshaperenderer3 = new
     * XYLineAndShapeRenderer(); xyplot.setDataset(i + 2 +
     * _nor_model.size(), xydataset3); xyplot.setRenderer(i + 2 +
     * _nor_model.size(), xylineandshaperenderer3); // ???
     * xylineandshaperenderer3.setBaseShapesVisible(false); // ??
     * xylineandshaperenderer3.setSeriesLinesVisible(0, true);
     * xylineandshaperenderer3.setSeriesShape(0, double1); // 
     * xylineandshaperenderer3.setSeriesPaint(0, Color.red);
     * xylineandshaperenderer3.setSeriesFillPaint(0, Color.red);
     * xylineandshaperenderer3.setSeriesOutlinePaint(0, Color.red);
     * xylineandshaperenderer3.setUseFillPaint(true);
     * xylineandshaperenderer3 .setBaseItemLabelGenerator(new
     * StandardXYItemLabelGenerator());
     * xylineandshaperenderer3.setSeriesStroke(0, new BasicStroke(2.5F));
     * 
     * }
     */
    // ??
    // 
    // /////////////////////////////////
    // ?

    XYDataset xydataset4 = createLineDataset(nor, abnor, mapAB, xyplot);

    // ??y=1
    ValueMarker valuemarker = new ValueMarker(1); // 
    valuemarker.setLabelOffsetType(LengthAdjustmentType.EXPAND);
    valuemarker.setPaint(Color.black); // ?
    valuemarker.setStroke(new BasicStroke(1.0F)); // 
    // valuemarker.setLabel(""); //?
    valuemarker.setLabelFont(new Font("SansSerif", 0, 11)); // ?
    valuemarker.setLabelPaint(Color.red);
    valuemarker.setLabelAnchor(RectangleAnchor.TOP_LEFT);
    valuemarker.setLabelTextAnchor(TextAnchor.BOTTOM_LEFT);
    xyplot.addRangeMarker(valuemarker);
    // //

    //jfreechart.getLegend().setVisible(true);
    return jfreechart;
}

From source file:com.sciaps.utils.Util.java

public static IntervalMarker createMarker(double min, double max, String element) {
    IntervalMarker marker = new IntervalMarker(min, max);
    marker.setPaint(Color.green);

    DecimalFormat df = new DecimalFormat("#0.000");
    String label = df.format(min);

    if (element != null) {
        label = element + ":" + label;
    }/*  w w  w.j  a v  a 2  s.  c o  m*/
    marker.setLabel(label);
    marker.setLabelPaint(Color.blue);
    marker.setLabelFont(new java.awt.Font("Tahoma", 1, 8));
    marker.setLabelOffset(new RectangleInsets(50, 10, 10, 20));

    return marker;
}

From source file:edu.cmu.sv.modelinference.eventtool.EventVisualizer.java

private static Map<EventClass, Color> assignClassColors(ClassificationResult results) {
    Color[] COLORS = { Color.GREEN, Color.RED, Color.BLACK, Color.BLUE, Color.GRAY, Color.CYAN, Color.DARK_GRAY,
            Color.MAGENTA };//from  w  w w.j  av  a  2s.c  om
    int colorIdx = 0;
    Map<EventClass, Color> cluster2Color = new HashMap<>();
    for (EventClass cl : results.getEventClasses()) {
        cluster2Color.put(cl, COLORS[colorIdx % COLORS.length]);
        colorIdx++;
    }
    return cluster2Color;
}

From source file:com.bdb.weather.display.summary.HighLowMedianTempPanel.java

/**
 * Load the data into the graph and the JTable.
 * //from  w ww  .j  a  v  a  2 s .  c om
 * @param summaryList The list of summary records to be loaded
 * @param lowDataset The graph's dataset that holds the low temperature values
 * @param highDataset The graph's dataset that holds the high temperature values
 * @param meanDataset The graph's dataset that holds the mean temperature values
 * @param tableModel The JTable model to be loaded
 * @param averagesCollection The averages to load into the graph and table
 */
private void loadDataSeries(List<SummaryRecord> summaryList, TimeSeriesCollection lowDataset,
        TimeSeriesCollection highDataset, TimeSeriesCollection meanDataset,
        WeatherAverages averagesCollection) {

    TimeSeries highSeries = new TimeSeries("High");
    TimeSeries lowSeries = new TimeSeries("Low");
    TimeSeries meanSeries = new TimeSeries("Mean");
    TimeSeries averageLowSeries = new TimeSeries("Average Low");
    TimeSeries averageHighSeries = new TimeSeries("Average High");
    TimeSeries averageMeanSeries = new TimeSeries("Average Mean");

    int n = 0;

    for (SummaryRecord r : summaryList) {
        //tableModel.setValueAt(dateFormat.format(r.getDate()), n, DATE_COLUMN);

        RegularTimePeriod p = RegularTimePeriod.createInstance(interval.getFreeChartClass(),
                TimeUtils.localDateTimeToDate(r.getDate().atStartOfDay()), TimeZone.getDefault());

        WeatherAverage averages = averagesCollection.getAverage(r.getDate());
        averageLowSeries.add(p, averages.getLowTemperature().get());
        averageHighSeries.add(p, averages.getHighTemperature().get());
        averageMeanSeries.add(p, averages.getMeanTemperature().get());
        //tableModel.setValueAt(averages.getHighTemperature().toString(), n, AVG_HIGH_TEMP_COLUMN);
        //tableModel.setValueAt(averages.getLowTemperature().toString(), n, AVG_LOW_TEMP_COLUMN);
        //tableModel.setValueAt(averages.getMeanTemperature().toString(), n, AVG_MEAN_TEMP_COLUMN);

        Temperature t = supporter.retrieveHighOutdoorTemperature(r);

        if (t != null) {
            highSeries.add(p, t.get());
            //tableModel.setValueAt(t.toString(), n, HIGH_TEMP_COLUMN);
        }

        t = supporter.retrieveLowOutdoorTemperature(r);

        if (t != null) {
            lowSeries.add(p, t.get());
            //tableModel.setValueAt(t.toString(), n, LOW_TEMP_COLUMN);
        }

        t = supporter.retrieveAvgOutdoorTemperature(r);

        if (t != null) {
            meanSeries.add(p, t.get());
            //tableModel.setValueAt(t.toString(), n, MEDIAN_TEMP_COLUMN);
        }

        n++;
    }

    highDataset.addSeries(highSeries);
    highDataset.addSeries(averageHighSeries);

    lowDataset.addSeries(lowSeries);
    lowDataset.addSeries(averageLowSeries);

    meanDataset.addSeries(meanSeries);
    meanDataset.addSeries(averageMeanSeries);

    diffRenderer.setSeriesPaint(ACTUAL_SERIES, Color.RED);
    diffRenderer.setSeriesPaint(AVERAGE_SERIES, Color.RED.darker());

    diffRenderer.setSeriesPaint(ACTUAL_SERIES, Color.BLUE);
    diffRenderer.setSeriesPaint(AVERAGE_SERIES, Color.BLUE.darker());

    diffRenderer.setSeriesPaint(ACTUAL_SERIES, Color.GREEN);
    diffRenderer.setSeriesPaint(AVERAGE_SERIES, Color.GREEN.darker());
}

From source file:com.polivoto.vistas.acciones.Datos.java

private void setcolors() {
    colores.add(Color.red);//from w  ww  . j  a  v a  2s. co m
    colores.add(Color.green);
    colores.add(Color.blue);
    colores.add(Color.yellow);
    colores.add(Color.magenta);
    colores.add(Color.cyan);
    colores.add(Color.pink);
    colores.add(Color.orange);
    colores.add(Color.darkGray);
    colores.add(Color.white);
}

From source file:com.ctsim.dmi.MainFrame.java

private void drawTargetDestance() {
    String str = df.format(App.targetDistance) + " m.";
    int strWidth;
    double barHeight;

    g2.drawImage(targetDestination, 30, 90, this);

    g2.setColor(Color.GREEN);
    g2.setFont(new Font("Loma", Font.PLAIN, 18));
    FontMetrics metrics = g2.getFontMetrics();
    strWidth = metrics.stringWidth(str);
    g2.drawString(str, 40 - (strWidth / 2), 70);

    barHeight = (App.targetDistanceActual / App.targetDistance) * 360;
    g2.fillRect(52, (int) (450 - barHeight), 14, (int) barHeight);
}

From source file:org.hxzon.demo.jfreechart.CategoryDatasetDemo2.java

private static JFreeChart createBarChart(CategoryDataset dataset) {

    CategoryAxis categoryAxis = new CategoryAxis(categoryAxisLabel);
    ValueAxis valueAxis = new NumberAxis(valueAxisLabel);

    BarRenderer renderer = new BarRenderer();
    if (orientation == PlotOrientation.HORIZONTAL) {
        ItemLabelPosition position1 = new ItemLabelPosition(ItemLabelAnchor.OUTSIDE3, TextAnchor.CENTER_LEFT);
        renderer.setBasePositiveItemLabelPosition(position1);
        ItemLabelPosition position2 = new ItemLabelPosition(ItemLabelAnchor.OUTSIDE9, TextAnchor.CENTER_RIGHT);
        renderer.setBaseNegativeItemLabelPosition(position2);
    } else if (orientation == PlotOrientation.VERTICAL) {
        ItemLabelPosition position1 = new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12,
                TextAnchor.BOTTOM_CENTER);
        renderer.setBasePositiveItemLabelPosition(position1);
        ItemLabelPosition position2 = new ItemLabelPosition(ItemLabelAnchor.OUTSIDE6, TextAnchor.TOP_CENTER);
        renderer.setBaseNegativeItemLabelPosition(position2);
    }//from w  ww. ja  v a  2 s.co m
    if (tooltips) {
        renderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator());
    }
    if (urls) {
        renderer.setBaseItemURLGenerator(new StandardCategoryURLGenerator());
    }

    CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, renderer);
    plot.setOrientation(orientation);
    JFreeChart chart = new JFreeChart("Bar Chart Demo 1", JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    chart.setBackgroundPaint(Color.white);

    valueAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    renderer.setDrawBarOutline(false);

    GradientPaint gp0 = new GradientPaint(0.0f, 0.0f, Color.blue, 0.0f, 0.0f, new Color(0, 0, 64));
    GradientPaint gp1 = new GradientPaint(0.0f, 0.0f, Color.green, 0.0f, 0.0f, new Color(0, 64, 0));
    GradientPaint gp2 = new GradientPaint(0.0f, 0.0f, Color.red, 0.0f, 0.0f, new Color(64, 0, 0));
    renderer.setSeriesPaint(0, gp0);
    renderer.setSeriesPaint(1, gp1);
    renderer.setSeriesPaint(2, gp2);

    plot.setDomainCrosshairVisible(true);
    plot.setRangeCrosshairVisible(true);

    categoryAxis
            .setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 6.0));

    return chart;

}