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.codehaus.mojo.chronos.chart.HistoryChartGenerator.java

public final void createGcChart(HistoricSamples samples, String dataId) throws IOException {
    XYPlot xyplot1 = newPlot(samples.getGcRatio(dataId), "chronos.label.gc.ratio", true);
    xyplot1.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);
    xyplot1.getRenderer().setSeriesPaint(0, Color.GREEN);
    xyplot1.getRangeAxis().setStandardTickUnits(NumberAxis.createStandardTickUnits());

    XYPlot xyplot2 = newPlot(samples.getKbCollectedPrSecond(dataId), "chronos.label.gc.kbpersec", true);
    xyplot2.setRangeAxisLocation(AxisLocation.TOP_OR_LEFT);
    xyplot2.getRenderer().setSeriesPaint(0, Color.GRAY);
    xyplot2.getRangeAxis().setStandardTickUnits(NumberAxis.createStandardTickUnits());

    String timeLabel = bundle.getString("chronos.label.gc.historytime");
    DateAxis timeAxis = ChartUtil.createTimeAxis(timeLabel, new SimpleDateFormat());
    XYPlot combinedPlot = ChartUtil.createCombinedPlot(timeAxis, xyplot1, xyplot2);
    // xyplot1.setDomainAxis( timeAxis );
    // XYPlot combinedPlot = xyplot1;
    JFreeChart chart = new JFreeChart(bundle.getString("chronos.label.gc"), combinedPlot);
    renderer.renderChart("history-gc-" + dataId, chart);
}

From source file:UserInterface.PublisherRole.ViewUserHabitsJPanel.java

private static JFreeChart createChart(PieDataset dataset) {

    JFreeChart chart = ChartFactory.createPieChart("User Habits", // chart title
            dataset, // data
            false, // no legend
            true, // tooltips
            false // no URL generation
    );//from  w w  w .  j  a v a  2 s.  c o  m

    // set a custom background for the chart
    chart.setBackgroundPaint(
            new GradientPaint(new Point(0, 0), new Color(20, 20, 20), new Point(400, 200), Color.DARK_GRAY));

    // customise the title position and font
    TextTitle t = chart.getTitle();
    t.setHorizontalAlignment(HorizontalAlignment.LEFT);
    t.setPaint(new Color(240, 240, 240));
    t.setFont(new Font("Arial", Font.BOLD, 26));

    PiePlot plot = (PiePlot) chart.getPlot();
    plot.setBackgroundPaint(null);
    plot.setInteriorGap(0.04);
    plot.setOutlineVisible(false);

    // use gradients and white borders for the section colours
    plot.setSectionPaint("Others", createGradientPaint(new Color(200, 200, 255), Color.BLUE));
    plot.setSectionPaint("Samsung", createGradientPaint(new Color(255, 200, 200), Color.RED));
    plot.setSectionPaint("Apple", createGradientPaint(new Color(200, 255, 200), Color.GREEN));
    plot.setSectionPaint("Nokia", createGradientPaint(new Color(200, 255, 200), Color.YELLOW));
    plot.setBaseSectionOutlinePaint(Color.WHITE);
    plot.setSectionOutlinesVisible(true);
    plot.setBaseSectionOutlineStroke(new BasicStroke(2.0f));

    // customise the section label appearance
    plot.setLabelFont(new Font("Courier New", Font.BOLD, 20));
    plot.setLabelLinkPaint(Color.WHITE);
    plot.setLabelLinkStroke(new BasicStroke(2.0f));
    plot.setLabelOutlineStroke(null);
    plot.setLabelPaint(Color.WHITE);
    plot.setLabelBackgroundPaint(null);

    // add a subtitle giving the data source
    TextTitle source = new TextTitle(" ", new Font("Courier New", Font.PLAIN, 12));
    source.setPaint(Color.WHITE);
    source.setPosition(RectangleEdge.BOTTOM);
    source.setHorizontalAlignment(HorizontalAlignment.RIGHT);
    chart.addSubtitle(source);
    return chart;

}

From source file:org.mili.jmibs.jfree.JFreeChartBarIterationObjectLoadIntervalBenchmarkSuiteResultRenderer.java

private JFreeChart createChart(String title, CategoryDataset dataset) {
    JFreeChart chart = ChartFactory.createBarChart(title, "Benchmark (Iteration/Object Loading/Interval)",
            "Time in ns", dataset, PlotOrientation.HORIZONTAL, true, true, false);
    chart.setBackgroundPaint(Color.white);
    CategoryPlot plot = (CategoryPlot) chart.getPlot();
    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    BarRenderer renderer = (BarRenderer) plot.getRenderer();
    renderer.setDrawBarOutline(false);//from   w  ww .j  ava2s .  com
    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);
    CategoryAxis domainAxis = plot.getDomainAxis();
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 6.0));
    return chart;
}

From source file:DualAxisDemo4.java

/**
 * Creates a new demo instance.//from  w  ww. ja  v  a2s  . c  om
 *
 * @param title  the frame title.
 */
public DualAxisDemo4(final String title) {

    super(title);

    final CategoryDataset dataset1 = createDataset1();

    // create the chart...
    final JFreeChart chart = ChartFactory.createBarChart3D("Dual Axis Chart", // chart title
            "Category", // domain axis label
            "Value", // range axis label
            dataset1, // data
            PlotOrientation.VERTICAL, true, // include legend
            true, false);

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

    // set the background color for the chart...
    chart.setBackgroundPaint(new Color(0xCC, 0xFF, 0xCC));
    //        chart.getLegend().setAnchor(Legend.SOUTH);

    // get a reference to the plot for further customisation...
    final CategoryPlot plot = chart.getCategoryPlot();
    plot.setDomainAxisLocation(AxisLocation.BOTTOM_OR_LEFT);
    plot.setRangeAxisLocation(AxisLocation.TOP_OR_LEFT);
    final CategoryItemRenderer renderer1 = plot.getRenderer();
    renderer1.setSeriesPaint(0, Color.red);
    renderer1.setSeriesPaint(1, Color.yellow);
    renderer1.setSeriesPaint(2, Color.green);
    final CategoryDataset dataset2 = createDataset2();
    final ValueAxis axis2 = new NumberAxis3D("Secondary");
    plot.setRangeAxis(1, axis2);
    plot.setDataset(1, dataset2);
    plot.mapDatasetToRangeAxis(1, 1);
    final CategoryItemRenderer renderer2 = new LineAndShapeRenderer();
    renderer2.setSeriesPaint(0, Color.blue);
    plot.setRenderer(1, renderer2);

    plot.setDatasetRenderingOrder(DatasetRenderingOrder.REVERSE);
    // OPTIONAL CUSTOMISATION COMPLETED.

    // add the chart to a panel...
    final ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
    setContentPane(chartPanel);

}

From source file:org.jfree.graphics2d.demo.CanvasBarChartDemo1.java

/**
 * Creates a sample chart./* ww  w  . ja v  a  2  s.c  o  m*/
 *
 * @param dataset  a dataset.
 *
 * @return The chart.
 */
private static JFreeChart createChart(CategoryDataset dataset) {

    // create the chart...
    JFreeChart chart = ChartFactory.createLineChart("Statistical Bar Chart Demo 1", // chart title
            "Type", // domain axis label
            "Value", // range axis label
            dataset);

    CategoryPlot plot = (CategoryPlot) chart.getPlot();

    // customise the range axis...
    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    rangeAxis.setAutoRangeIncludesZero(false);

    // customise the renderer...
    StatisticalBarRenderer renderer = new StatisticalBarRenderer();
    renderer.setDrawBarOutline(false);
    renderer.setErrorIndicatorPaint(Color.black);
    renderer.setIncludeBaseInRange(false);
    plot.setRenderer(renderer);

    // ensure the current theme is applied to the renderer just added
    ChartUtilities.applyCurrentTheme(chart);

    renderer.setDefaultItemLabelGenerator(new StandardCategoryItemLabelGenerator());
    renderer.setDefaultItemLabelsVisible(true);
    renderer.setDefaultItemLabelPaint(Color.yellow);
    renderer.setDefaultPositiveItemLabelPosition(
            new ItemLabelPosition(ItemLabelAnchor.INSIDE6, TextAnchor.BOTTOM_CENTER));

    // set up gradient paints for series...
    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));
    renderer.setSeriesPaint(0, gp0);
    renderer.setSeriesPaint(1, gp1);
    return chart;
}

From source file:org.nekorp.workflow.desktop.view.ServicioDatosGeneralesView.java

public void bindComponents() {
    //bindings con el servicio
    bindingManager.registerBind(viewServicioModel, "id", (Bindable) this.numeroServicio);
    bindingManager.registerBind(viewServicioModel.getAuto(), "placas", (Bindable) this.placas);
    //bindings con el cliente
    bindingManager.registerBind(viewServicioModel.getCliente(), "nombre", (Bindable) this.nombreCliente);
    //bindings con el metadata de la bitacora
    bindingManager.registerBind(bitacoraMetaData, "fechaInicioServicio", (Bindable) this.inicioServicio);
    bindingManager.registerBind(bitacoraMetaData, "fechaFinServicio", (Bindable) this.finServicio);
    bindingManager.registerBind(bitacoraMetaData, "tiempoServicio", (Bindable) this.duracionServicio);

    bindingManager.registerBind(bitacoraMetaData, "fechaEntrada", (Bindable) this.ingreso);
    bindingManager.registerBind(bitacoraMetaData, "fechaSalidaAuto", (Bindable) this.salida);
    bindingManager.registerBind(bitacoraMetaData, "tiempoEstadia", (Bindable) this.tiempo);

    //bindings al metadata de cobranza cobranzaMetadata
    bindingManager.registerBind(cobranzaMetadata, "saldo", (Bindable) this.saldo);
    Bindable saldoDecoratorBind = new ReadOnlyBinding() {
        @Override//from   www  .  ja  va2s .c  om
        public void notifyUpdate(Object origen, String property, Object value) {
            CobranzaWarningLevel warningLevel = (CobranzaWarningLevel) value;
            switch (warningLevel) {
            case info:
                saldo.setBackground(Color.GREEN);
                saldo.setBorder(javax.swing.BorderFactory.createLineBorder(Color.GREEN, 4));
                break;

            case warn:
                saldo.setBackground(Color.YELLOW);
                saldo.setBorder(javax.swing.BorderFactory.createLineBorder(Color.YELLOW, 4));
                break;

            case urgent:
                saldo.setBackground(Color.RED);
                saldo.setBorder(javax.swing.BorderFactory.createLineBorder(Color.RED, 4));
                break;

            default:
                saldo.setBackground(Color.GREEN);
                saldo.setBorder(javax.swing.BorderFactory.createLineBorder(Color.GREEN, 4));
                break;
            }
        }
    };
    bindingManager.registerBind(cobranzaMetadata, "warningLevel", saldoDecoratorBind);
}

From source file:action.ImageAction.java

public JFreeChart getChart() {
    DefaultPieDataset dataset = new DefaultPieDataset();
    dataset.setValue("Ford", 23.3);
    dataset.setValue("Chevy", 32.4);
    dataset.setValue("Yugo", 44.2);

    boolean legend = true;
    boolean tooltips = false;
    boolean urls = false;

    JFreeChart chart = (JFreeChart) ChartFactory.createPieChart("Cars", dataset, legend, tooltips, urls);

    chart.setBorderPaint(Color.GREEN);
    chart.setBorderStroke(new BasicStroke(5.0f));
    chart.setBorderVisible(true);//from  w  w  w  . j a  va2 s . co m

    return chart;
}

From source file:org.sonar.plugins.buildstability.BuildStabilityChart.java

private void configureRenderer(CategoryPlot plot, String colors) {
    ColoredBarRenderer renderer = new ColoredBarRenderer();

    String[] pairs = StringUtils.split(colors, ";");
    ArrayList<Paint> paints = new ArrayList<Paint>();
    for (String pair : pairs) {
        String[] keyValue = StringUtils.split(pair, "=");
        paints.add("r".equals(keyValue[1]) ? Color.RED : Color.GREEN);
    }/*from ww w  .j a va 2 s  .  c  om*/

    renderer.setColors(paints.toArray(new Paint[paints.size()]));
    renderer.setDrawBarOutline(true);
    renderer.setSeriesItemLabelsVisible(0, true);
    renderer.setItemMargin(0);
    plot.setRenderer(renderer);
}

From source file:sernet.gs.ui.rcp.main.bsi.views.chart.RealisierungLineChart.java

private JFreeChart createProgressChart(Object dataset) {
    final double plotGap = 10.0;
    final int axisUpperBoundPadding = 50;
    final int labelFontSize = 10;
    XYDataset data1 = (XYDataset) dataset;
    XYItemRenderer renderer1 = new StandardXYItemRenderer();
    NumberAxis rangeAxis1 = new NumberAxis(Messages.RealisierungLineChart_1);
    XYPlot subplot1 = new XYPlot(data1, null, rangeAxis1, renderer1);
    subplot1.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);

    CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new DateAxis(Messages.RealisierungLineChart_2));
    plot.setGap(plotGap);/* ww  w. ja va2  s .com*/

    plot.add(subplot1, 1);
    plot.setOrientation(PlotOrientation.VERTICAL);

    CountMassnahmen command = new CountMassnahmen();
    try {
        command = ServiceFactory.lookupCommandService().executeCommand(command);
    } catch (CommandException e) {
        ExceptionUtil.log(e, Messages.RealisierungLineChart_3);
    }
    int totalNum = command.getTotalCount();

    NumberAxis axis = (NumberAxis) subplot1.getRangeAxis();
    axis.setUpperBound(totalNum + axisUpperBoundPadding);

    ValueMarker bst = new ValueMarker(totalNum);
    bst.setPaint(Color.GREEN);
    bst.setLabel(Messages.RealisierungLineChart_4);
    bst.setLabelAnchor(RectangleAnchor.LEFT);
    bst.setLabelFont(new Font("SansSerif", Font.ITALIC + Font.BOLD, labelFontSize)); //$NON-NLS-1$
    bst.setLabelTextAnchor(TextAnchor.CENTER_LEFT);
    subplot1.addRangeMarker(bst, Layer.BACKGROUND);

    // return a new chart containing the overlaid plot...
    JFreeChart chart = new JFreeChart(Messages.RealisierungLineChart_6, JFreeChart.DEFAULT_TITLE_FONT, plot,
            true);
    chart.setBackgroundPaint(Color.white);
    return chart;
}

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

/**
 * Creates a chart.//w w w  . ja  v  a 2  s  .  c  o m
 * 
 * @param dataset  the dataset.
 * 
 * @return The chart.
 */
private JFreeChart createChart(final XYDataset dataset) {
    final JFreeChart chart = ChartFactory.createTimeSeriesChart("Difference Chart Demo", "Time", "Value",
            dataset, true, // legend
            true, // tool tips
            false // URLs
    );
    chart.setBackgroundPaint(Color.white);

    final XYPlot plot = chart.getXYPlot();
    plot.setRenderer(new XYDifferenceRenderer(Color.green, Color.red, false));
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    //        plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 5.0, 5.0, 5.0, 5.0));

    final ValueAxis domainAxis = new DateAxis("Time");
    domainAxis.setLowerMargin(0.0);
    domainAxis.setUpperMargin(0.0);
    plot.setDomainAxis(domainAxis);
    plot.setForegroundAlpha(0.5f);
    return chart;
}