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:net.sf.dynamicreports.test.jasper.chart.XyBlockChartTest.java

@Override
protected void configureReport(JasperReportBuilder rb) {
    TextColumnBuilder<Integer> column1;
    TextColumnBuilder<Integer> column2;
    TextColumnBuilder<Integer> column3;

    Locale.setDefault(Locale.ENGLISH);

    rb.columns(column1 = col.column("Column1", "field1", Integer.class),
            column2 = col.column("Column2", "field2", Integer.class),
            column3 = col.column("Column3", "field3", Integer.class))
            .summary(//w  w w .  j ava2s. c  o  m
                    cht.xyBlockChart(0.1, 5, Color.WHITE).setXValue(column1)
                            .series(cht.xyzSerie().setYValue(column2).setZValue(column3)).setBlockWidth(1.1)
                            .setBlockHeight(0.9).setBlockAnchor(RectangleAnchor.BOTTOM_LEFT)
                            .paintScales(cht.paintScale("1", 1, Color.RED), cht.paintScale("2", 2, Color.GREEN),
                                    cht.paintScale("3", 3, Color.BLUE)),
                    cht.xyBlockChart(0, 5, Color.WHITE).setXValue(column1)
                            .series(cht.xyzSerie().setYValue(column2).setZValue(column3))
                            .setXAxisFormat(cht.axisFormat().setLabel("category").setLabelColor(Color.BLUE)
                                    .setLabelFont(stl.fontArialBold())
                                    .setTickLabelFont(stl.fontArial().setItalic(true))
                                    .setTickLabelColor(Color.CYAN).setLineColor(Color.LIGHT_GRAY)),
                    cht.xyBlockChart(0, 5, Color.WHITE).setXValue(column1)
                            .series(cht.xyzSerie().setYValue(column2).setZValue(column3))
                            .setYAxisFormat(cht.axisFormat().setLabel("value").setLabelColor(Color.BLUE)
                                    .setLabelFont(stl.fontArialBold())
                                    .setTickLabelFont(stl.fontArial().setItalic(true))
                                    .setTickLabelColor(Color.CYAN).setTickLabelMask("#,##0.00")
                                    .setLineColor(Color.LIGHT_GRAY)));
}

From source file:net.sf.dynamicreports.test.jasper.chart.ChartSeriesOrderTest.java

@Override
protected void configureReport(JasperReportBuilder rb) {
    TextColumnBuilder<String> column1;
    TextColumnBuilder<String> column2;
    TextColumnBuilder<Integer> column3;
    TextColumnBuilder<String> column4;

    colors = new HashMap<String, Color>();
    colors.put("a", Color.BLUE);
    colors.put("b", Color.YELLOW);
    colors.put("c", Color.GREEN);
    colors.put("d", Color.MAGENTA);

    rb.setPageFormat(PageType.A3, PageOrientation.PORTRAIT)
            .columns(column1 = col.column("Column1", "field1", String.class),
                    column2 = col.column("Column2", "field2", String.class),
                    column3 = col.column("Column3", "field3", Integer.class),
                    column4 = col.column("Column4", "field4", String.class))
            .summary(// w ww.j  a  va2s.  c o m
                    cmp.horizontalList(
                            cht.barChart().seriesColorsByName(colors).setSeriesOrderType(OrderType.ASCENDING)
                                    .setCategory(column1).series(cht.serie(column3).setSeries(column2)),
                            cht.groupedStackedBarChart().seriesColorsByName(colors)
                                    .setSeriesOrderType(OrderType.ASCENDING).setCategory(column1)
                                    .series(cht.groupedSerie(column3).setSeries(column2).setGroup(column4))),
                    cmp.horizontalList(cht.barChart().seriesColorsByName(colors)
                            .setSeriesOrderType(OrderType.DESCENDING).setCategory(column1).series(cht
                                    .serie(column3).setSeries(column2)),
                            cht.groupedStackedBarChart().seriesColorsByName(colors)
                                    .setSeriesOrderType(OrderType.DESCENDING).setCategory(column1)
                                    .series(cht.groupedSerie(column3).setSeries(column2).setGroup(column4))),
                    cmp.horizontalList(cht.barChart().seriesColorsByName(colors)
                            .setSeriesOrderBy(Arrays.asList("c", "b", "a", "d")).setCategory(column1)
                            .series(cht.serie(column3).setSeries(column2)),
                            cht.groupedStackedBarChart().seriesColorsByName(colors)
                                    .setSeriesOrderBy(Arrays.asList("c", "b", "a", "d")).setCategory(column1)
                                    .series(cht.groupedSerie(column3).setSeries(column2).setGroup(column4))),
                    cmp.horizontalList(
                            cht.barChart().seriesColorsByName(colors).seriesOrderBy("c", "b", "a", "d")
                                    .setSeriesOrderType(OrderType.DESCENDING).setCategory(column1)
                                    .series(cht.serie(column3).setSeries(column2)),
                            cht.groupedStackedBarChart().seriesColorsByName(colors)
                                    .seriesOrderBy("c", "b", "a", "d").setSeriesOrderType(OrderType.DESCENDING)
                                    .setCategory(column1)
                                    .series(cht.groupedSerie(column3).setSeries(column2).setGroup(column4))),
                    cmp.horizontalList(
                            cht.barChart().seriesColorsByName(colors).seriesOrderBy("c", "e", "d")
                                    .setCategory(column1).series(cht.serie(column3).setSeries(column2)),
                            cht.barChart().seriesColorsByName(colors).seriesOrderBy("g", "e", "d")
                                    .setSeriesOrderType(OrderType.DESCENDING).setCategory(column1)
                                    .series(cht.serie(column3).setSeries(column2))));
}

From source file:net.sf.dynamicreports.test.jasper.chart.ChartTest.java

@Override
protected void configureReport(JasperReportBuilder rb) {
    TextColumnBuilder<String> column1;
    TextColumnBuilder<Integer> column2;

    rb.columns(column1 = col.column("Column1", "field1", String.class),
            column2 = col.column("Column2", "field2", Integer.class))
            .summary(cht.barChart().setTitle("title").setTitleColor(Color.BLUE)
                    .setTitleFont(stl.fontArialBold()).setTitlePosition(Position.RIGHT).setSubtitle("subtitle")
                    .setSubtitleColor(Color.CYAN).setSubtitleFont(stl.fontArial()).setLegendColor(Color.BLUE)
                    .setLegendBackgroundColor(Color.LIGHT_GRAY).setLegendFont(stl.fontCourierNew())
                    .setLegendPosition(Position.LEFT).setCategory(column1).series(cht.serie(column2)),
                    cht.barChart().setShowLegend(false).setOrientation(Orientation.HORIZONTAL)
                            .seriesColors(Color.BLUE, Color.GREEN, Color.RED).setCategory(column1)
                            .series(cht.serie(column2), cht.serie(column2).setLabel("2"),
                                    cht.serie(column2).setLabel("3")));
}

From source file:de.bund.bfr.jung.JungUtils.java

public static <V, E> Transformer<E, Paint> newEdgeDrawTransformer(RenderContext<V, E> renderContext) {
    return edge -> {
        return renderContext.getPickedEdgeState().isPicked(edge) ? Color.GREEN : null;
    };/*  w  w  w  .ja  v a 2 s .  c o  m*/
}

From source file:contactangle.ImageControl.java

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

    if (img != null)
        g.drawImage(img, 0, 0, this);
    else/*from w ww . j  a  v a2 s.  c  o m*/
        g.drawString("NO IMAGE", 0, 15);

    g.setColor(Color.RED);

    if (x1 < x2 && y1 < y2)
        g.drawRect(x1, y1, x2 - x1, y2 - y1);
    else if (x1 >= x2 && y1 < y2)
        g.drawRect(x2, y1, x1 - x2, y2 - y1);
    else if (x1 < x2 && y1 >= y2)
        g.drawRect(x1, y2, x2 - x1, y1 - y2);
    else
        g.drawRect(x2, y2, x1 - x2, y1 - y2);

    if (valid && img != null) {

        if (x1 >= x2) {
            int temp = x1;
            x1 = x2;
            x2 = temp;
        }
        if (y1 >= y2) {
            int temp = y1;
            y1 = y2;
            y2 = temp;
        }

        choosenPoints = new ArrayList<Point>();
        for (int y = y1; y < y2; y++) {
            for (int x = x1; x < x2; x++) {
                int pixelData = img.getRGB(x, y);
                if (pixelData == -1)
                    choosenPoints.add(new Point(x, y));
            }
        }

        SimpleRegression reg = new SimpleRegression();
        for (Point p : choosenPoints) {
            reg.addData(p.x, p.y);
        }

        int firstX = choosenPoints.get(0).x;
        int firstY = choosenPoints.get(0).y;
        double slope = reg.getSlope();
        g.setColor(Color.GREEN);
        g.drawLine(firstX, firstY, firstX + (70), firstY + (int) (slope * (70)));
        g.drawLine(firstX, firstY, firstX - (70), firstY - (int) (slope * (70)));

        double contactDegrees = (Math.atan(reg.getSlope()) / (2 * Math.PI)) * 360.0;

        DecimalFormat d = new DecimalFormat("##.###");

        g.drawString("Contact Angle = ", 25, 25);
        g.drawString(d.format(contactDegrees) + " degrees", 25, 38);
    }

}

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

/**
 * Creates a chart.//w  w w  . ja  v a  2s  . c o m
 * 
 * @param dataset  the dataset.
 * 
 * @return The chart.
 */
private JFreeChart createChart(final WindDataset dataset) {

    final JFreeChart chart = ChartFactory.createWindPlot("Wind Chart Demo", "Date", "Direction / Force",
            dataset, true, false, false);

    // then customise it a little...
    chart.setBackgroundPaint(new GradientPaint(0, 0, Color.white, 1000, 0, Color.green));
    return chart;

}

From source file:net.sf.profiler4j.console.MemoryPlotPanel.java

public MemoryPlotPanel(int maxAge, String title) {
    super(new BorderLayout());

    totalSeries = new TimeSeries("Committed Memory", Millisecond.class);
    totalSeries.setMaximumItemAge(maxAge);
    usedSeries = new TimeSeries("Used Memory", Millisecond.class);
    usedSeries.setMaximumItemAge(maxAge);
    TimeSeriesCollection seriesCollection = new TimeSeriesCollection();
    seriesCollection.addSeries(totalSeries);
    seriesCollection.addSeries(usedSeries);

    NumberAxis numberAxis = new NumberAxis("Memory (KB)");
    numberAxis.setLabelFont(new Font("SansSerif", 0, 14));
    numberAxis.setTickLabelFont(new Font("SansSerif", 0, 12));
    numberAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    DateAxis dateAxis = new DateAxis("Time");
    dateAxis.setTickLabelFont(new Font("SansSerif", 0, 12));
    dateAxis.setLabelFont(new Font("SansSerif", 0, 14));
    dateAxis.setAutoRange(true);//  w  ww .jav  a 2  s .c  o  m
    dateAxis.setLowerMargin(0);
    dateAxis.setUpperMargin(0);
    dateAxis.setTickLabelsVisible(true);
    dateAxis.setDateFormatOverride(new SimpleDateFormat("HH:mm:ss"));

    XYLineAndShapeRenderer lineRenderer = new XYLineAndShapeRenderer(true, false);
    lineRenderer.setSeriesPaint(0, Color.RED);
    lineRenderer.setSeriesPaint(1, Color.GREEN.darker());
    lineRenderer.setStroke(new BasicStroke(2F, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));

    XYPlot xyplot = new XYPlot(seriesCollection, dateAxis, numberAxis, lineRenderer);
    xyplot.setBackgroundPaint(Color.WHITE);
    xyplot.setDomainGridlinePaint(Color.LIGHT_GRAY);
    xyplot.setRangeGridlinePaint(Color.LIGHT_GRAY);
    xyplot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D));

    JFreeChart chart = new JFreeChart(title, new Font("SansSerif", Font.PLAIN, 14), xyplot, true);
    chart.setBackgroundPaint(Color.white);

    ChartPanel panel = new ChartPanel(chart);
    panel.setBorder(createCompoundBorder(createEmptyBorder(8, 8, 8, 8), createLineBorder(Color.LIGHT_GRAY)));
    add(panel);
    setBorder(createEmptyBorder(8, 8, 8, 8));
}

From source file:com.spotify.heroic.http.render.RenderUtils.java

public static JFreeChart createChart(final List<ShardedResultGroup> groups, final String title,
        Map<String, String> highlight, Double threshold, int height) {
    final XYLineAndShapeRenderer lineAndShapeRenderer = new XYLineAndShapeRenderer(true, true);
    final DeviationRenderer intervalRenderer = new DeviationRenderer();

    final XYSeriesCollection regularData = new XYSeriesCollection();
    final YIntervalSeriesCollection intervalData = new YIntervalSeriesCollection();

    int lineAndShapeCount = 0;
    int intervalCount = 0;

    for (final ShardedResultGroup resultGroup : groups) {
        final MetricCollection group = resultGroup.getMetrics();

        if (group.getType() == MetricType.POINT) {
            final XYSeries series = new XYSeries(resultGroup.getMetrics().toString());

            final List<Point> data = group.getDataAs(Point.class);

            for (final Point d : data) {
                series.add(d.getTimestamp(), d.getValue());
            }// w  w  w . j a v a 2s.  com

            lineAndShapeRenderer.setSeriesPaint(lineAndShapeCount, Color.BLUE);
            lineAndShapeRenderer.setSeriesShapesVisible(lineAndShapeCount, false);
            lineAndShapeRenderer.setSeriesStroke(lineAndShapeCount, new BasicStroke(2.0f));
            regularData.addSeries(series);
            ++lineAndShapeCount;
        }

        if (group.getType() == MetricType.SPREAD) {
            final YIntervalSeries series = new YIntervalSeries(resultGroup.getMetrics().toString());

            final List<Spread> data = group.getDataAs(Spread.class);

            for (final Spread d : data) {
                series.add(d.getTimestamp(), d.getSum() / d.getCount(), d.getMin(), d.getMax());
            }

            intervalRenderer.setSeriesPaint(intervalCount, Color.GREEN);
            intervalRenderer.setSeriesStroke(intervalCount, new BasicStroke(2.0f));
            intervalRenderer.setSeriesFillPaint(intervalCount, new Color(200, 255, 200));
            intervalRenderer.setSeriesShapesVisible(intervalCount, false);
            intervalData.addSeries(series);
            ++intervalCount;
        }
    }

    final JFreeChart chart = buildChart(title, regularData, intervalData, lineAndShapeRenderer,
            intervalRenderer);

    chart.setAntiAlias(true);
    chart.setBackgroundPaint(Color.WHITE);

    final XYPlot plot = chart.getXYPlot();

    plot.setBackgroundPaint(Color.WHITE);
    plot.setDomainGridlinePaint(Color.BLACK);
    plot.setRangeGridlinePaint(Color.BLACK);

    if (threshold != null) {
        final ValueMarker marker = new ValueMarker(threshold, Color.RED,
                new BasicStroke(Math.max(Math.min(height / 20, 6), 1)), Color.RED, null, 0.5f);
        plot.addRangeMarker(marker);
    }

    plot.setRenderer(lineAndShapeRenderer);

    // final DateAxis rangeAxis = (DateAxis) plot.getRangeAxis();
    // rangeAxis.setStandardTickUnits(DateAxis.createStandardDateTickUnits());

    return chart;
}

From source file:org.codehaus.mojo.chronos.chart.SummaryThroughputChartSource.java

private XYPlot createThroughputPlot(ResourceBundle bundle, ReportConfig config) {
    TimeSeriesCollection dataset1 = createThroughputDataset(bundle, config);
    XYPlot throughputPlot = ChartUtil.newPlot(dataset1, bundle.getString("chronos.label.throughput.requests"),
            true);//www  .j av a  2  s. co m
    throughputPlot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);
    throughputPlot.getRenderer().setSeriesPaint(0, Color.GREEN);
    throughputPlot.getRenderer().setSeriesPaint(1, Color.BLUE);
    throughputPlot.setSeriesRenderingOrder(SeriesRenderingOrder.FORWARD);

    double maxAvgThroughput = samples.getMaxAverageThroughput(config.getAverageduration(),
            config.getResponsetimedivider());
    String maxThroughputLabel = bundle.getString("chronos.label.maxaveragethroughput");
    ChartUtil.addRangeMarker(throughputPlot, maxThroughputLabel, maxAvgThroughput);
    return throughputPlot;
}

From source file:org.trade.ui.chart.renderer.HeikinAshiRenderer.java

/**
 * Constructor for HeikinAshiRenderer./*from w ww .  j a v  a2s  .  co  m*/
 * 
 * @param nightMode
 *            boolean
 */
public HeikinAshiRenderer(boolean nightMode) {
    this.nightMode = nightMode;
    configureToolTips();
    if (nightMode) {
        upPaint = Color.green;
        downPaint = Color.red;
    } else {
        upPaint = Color.green;
        downPaint = Color.red;
    }
}