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:com.mentor.questa.ucdb.jenkins.QuestaCoverageAction.java

private JFreeChart createBarChart(final StaplerRequest req, final CategoryDataset dataset, final String title) {
    JFreeChart chart = ChartFactory.createBarChart(title, //title
            null, //categoryaxislabel, 
            null, //valueaxislabel    
            dataset, //dataset
            PlotOrientation.HORIZONTAL, //orientation
            false, //legend
            true, //tooltips
            false //urls
    );/*from w  ww. j  av a2 s  .c o  m*/

    // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
    chart.setBackgroundPaint(Color.white);

    final CategoryPlot plot = chart.getCategoryPlot();

    plot.setBackgroundPaint(Color.WHITE);
    plot.setOutlinePaint(null);
    plot.setForegroundAlpha(0.8f);

    final BarRenderer cir = new BarRenderer() {
        private final Paint[] colors = { Color.red, Color.blue, Color.green, Color.yellow, Color.orange,
                Color.cyan, Color.magenta, Color.blue };

        /**
         * Returns the paint for an item. Overrides the default behavior
         * inherited from AbstractSeriesRenderer.
         *
         * @param row the series.
         * @param column the category.
         *
         * @return The item color.
         */
        @Override
        public Paint getItemPaint(final int row, final int column) {
            return colors[column % colors.length];
        }
    };
    cir.setMaximumBarWidth(0.35);
    plot.setRenderer(cir);

    // crop extra space around the graph
    plot.setInsets(new RectangleInsets(0, 0, 0, 5.0));

    return chart;
}

From source file:patientview.HistoryJFrame.java

public void genGraph(int code) {
    //ArrayList<LiveData> data = thisPatient.getLiveDatahistory(timerCSeconds); //Displays live data up untill the current moment
    ArrayList<LiveData> data = thisPatient.getAllLiveData();

    //create and populate graph
    XYSeries rr = new XYSeries("Respiratory rate (breaths/min)");
    XYSeries os = new XYSeries("Oxygen saturation (%)");
    XYSeries t = new XYSeries("Temperature (C)");
    XYSeries sbp = new XYSeries("Systolic blood pressure (mmHg)");
    XYSeries hr = new XYSeries("Heart rate (beats/min)");

    for (int i = 0; i < data.size(); i++) {
        rr.add(i * 5, data.get(i).rr);//  w w  w.j a v a 2  s  .  co  m
        os.add(i * 5, data.get(i).os);
        t.add(i * 5, data.get(i).t);
        sbp.add(i * 5, data.get(i).sbp);
        hr.add(i * 5, data.get(i).hr);
    }

    XYDataset xyDataset1 = new XYSeriesCollection(rr);
    XYDataset xyDataset2 = new XYSeriesCollection(os);
    XYDataset xyDataset3 = new XYSeriesCollection(t);
    XYDataset xyDataset4 = new XYSeriesCollection(sbp);
    XYDataset xyDataset5 = new XYSeriesCollection(hr);

    JFreeChart chart = ChartFactory.createXYLineChart(thisPatient.getFullName(), "Time (s)", "", null,
            PlotOrientation.VERTICAL, true, true, false);

    this.plot = chart.getXYPlot();

    this.plot.setRenderer(0, new StandardXYItemRenderer());
    this.plot.setRenderer(1, new StandardXYItemRenderer());
    this.plot.setRenderer(2, new StandardXYItemRenderer());
    this.plot.setRenderer(3, new StandardXYItemRenderer());
    this.plot.setRenderer(4, new StandardXYItemRenderer());

    boolean markers = false;
    if ((code & 32) == 32) {
        markers = true;
    }
    //respiratory rate
    if ((code & 1) == 1) {
        this.plot.setDataset(0, xyDataset1);
        if (markers) {
            IntervalMarker zone = new IntervalMarker(9, 20);
            zone.setPaint(new Color(255, 0, 0, 64));
            plot.addRangeMarker(zone);
        }
        this.plot.getRendererForDataset(plot.getDataset(0)).setSeriesPaint(0, Color.red);
    }
    //oxygen saturation
    if ((code & 2) == 2) {
        this.plot.setDataset(1, xyDataset2);
        if (markers) {
            IntervalMarker zone = new IntervalMarker(93, 100);
            zone.setPaint(new Color(0, 255, 0, 64));
            plot.addRangeMarker(zone);
        }
        this.plot.getRendererForDataset(plot.getDataset(1)).setSeriesPaint(0, Color.green);
    }
    //temperature
    if ((code & 4) == 4) {
        this.plot.setDataset(2, xyDataset3);
        if (markers) {
            IntervalMarker zone = new IntervalMarker(36, 37.9);
            zone.setPaint(new Color(0, 0, 255, 64));
            plot.addRangeMarker(zone);
        }
        this.plot.getRendererForDataset(plot.getDataset(2)).setSeriesPaint(0, Color.blue);
    }
    //systolic blood pressure
    if ((code & 8) == 8) {
        this.plot.setDataset(3, xyDataset4);
        if (markers) {
            IntervalMarker zone = new IntervalMarker(100, 199);
            zone.setPaint(new Color(255, 255, 0, 64));
            plot.addRangeMarker(zone);
        }
        this.plot.getRendererForDataset(plot.getDataset(3)).setSeriesPaint(0, Color.yellow);
    }
    //heart rate
    if ((code & 16) == 16) {
        this.plot.setDataset(4, xyDataset5);
        if (markers) {
            IntervalMarker zone = new IntervalMarker(50, 99);
            zone.setPaint(new Color(255, 0, 255, 64));
            plot.addRangeMarker(zone);
        }
        this.plot.getRendererForDataset(plot.getDataset(4)).setSeriesPaint(0, Color.magenta);
    }

    graphPanel.removeAll();
    cp = new ChartPanel(chart);
    cp.setMouseWheelEnabled(true);
    cp.setPreferredSize(new Dimension(640, 480));
    graphPanel.setLayout(new java.awt.BorderLayout());
    graphPanel.add(cp, java.awt.BorderLayout.CENTER);
    graphPanel.validate();

}

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

/**
 * Displays an XYPlot with symbolic axes.
 * /*from w  w  w . ja va 2 s .c o  m*/
 * @param frameTitle
 *           the frame title.
 * @param data
 *           the dataset.
 * @param chartTitle
 *           the chart title.
 * @param xAxisLabel
 *           the x axis label.
 * @param yAxisLabel
 *           the y axis label.
 */
private static void displayXYSymbolic(final String frameTitle, final XYDataset data, final String chartTitle,
        final String xAxisLabel, final String yAxisLabel) {

    final JFreeChart chart = createXYSymbolicPlot(chartTitle, xAxisLabel, yAxisLabel, data, true);
    chart.setBackgroundPaint(new GradientPaint(0, 0, Color.white, 1000, 0, Color.green));
    final JFrame frame = new ChartFrame(frameTitle, chart);
    frame.pack();
    RefineryUtilities.positionFrameRandomly(frame);
    frame.show();

}

From source file:edu.ucla.stat.SOCR.chart.demo.BarChartDemo7.java

/**
 * Creates a sample chart.//w  w w. j a v  a2 s. c  o m
 * 
 * @param dataset  the dataset.
 * 
 * @return The chart.
 */
protected JFreeChart createChart(CategoryDataset dataset) {

    // create the chart...
    JFreeChart chart = ChartFactory.createBarChart(chartTitle, // chart title
            domainLabel, // domain axis label
            rangeLabel, // range axis label
            dataset, // data
            PlotOrientation.VERTICAL, // orientation
            !legendPanelOn, // 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...
    CategoryPlot plot = chart.getCategoryPlot();
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);

    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...
    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

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

    // set up gradient paints for series...
    GradientPaint gp0 = new GradientPaint(0.0f, 0.0f, Color.blue, 0.0f, 0.0f, Color.lightGray);
    GradientPaint gp1 = new GradientPaint(0.0f, 0.0f, Color.green, 0.0f, 0.0f, Color.lightGray);
    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.setLegendItemLabelGenerator(new SOCRCategorySeriesLabelGenerator());

    renderer.setBaseItemLabelGenerator(new CustomCategoryItemLabelGenerator());
    renderer.setBaseItemLabelsVisible(true);
    ItemLabelPosition p = new ItemLabelPosition(ItemLabelAnchor.INSIDE12, TextAnchor.CENTER_RIGHT,
            TextAnchor.CENTER_RIGHT, -Math.PI / 2.0);
    renderer.setBasePositiveItemLabelPosition(p);

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

}

From source file:umontreal.ssj.charts.SSJCategorySeriesCollection.java

/**
 * Gives the default color associated with a series
 *
 * @param   index Index of the series in the CategoryDataset object.
 * @return        default color object.//ww  w  .  j  av a2s .  com
 */
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
        return Color.CYAN;
}

From source file:org.psystems.dicom.browser.server.stat.StatClientRequestsChartServlet.java

public JFreeChart getChart(CategoryDataset dataset) {
    // create the chart...
    final JFreeChart chart = ChartFactory.createBarChart("? ?", // chart title
            "", // domain axis label
            "? (.)", // range axis label
            dataset, // data
            PlotOrientation.VERTICAL, // orientation
            true, // include legend
            true, // tooltips?
            false // URLs?
    );//from w  w w  .ja  va2  s.  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);

    // final IntervalMarker target = new IntervalMarker(2000000, 3000000);
    // target.setLabel(" ");
    // 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);

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

    return chart;
}

From source file:com.argeloji.server.BarChartDemo4.java

/**
 * Creates a sample chart./* w ww.j  a v a2s.c o m*/
 * 
 * @param dataset  the dataset.
 * 
 * @return The chart.
 */
private JFreeChart createChart(final CategoryDataset dataset) {

    // create the chart...
    final JFreeChart chart = ChartFactory.createBarChart("Cevap Dalm", // chart title
            "Seenekler", // domain axis label
            "renci Says", // range axis label
            dataset, // data
            PlotOrientation.VERTICAL, true, // include legend
            true, // tooltips?
            false // URLs?
    );

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

    // set the background color for the chart...
    chart.setBackgroundPaint(new Color(0xFFFFFF));

    // get a reference to the plot for further customisation...
    final CategoryPlot plot = chart.getCategoryPlot();

    // 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.setMaxBarWidth(0.10);

    // set up gradient paints for series...
    final GradientPaint gp0 = new GradientPaint(0.0f, 0.0f, Color.GREEN, 0.0f, 0.0f, Color.GREEN);
    final GradientPaint gp1 = new GradientPaint(0.0f, 0.0f, Color.RED, 0.0f, 0.0f, Color.RED);
    final GradientPaint gp2 = new GradientPaint(0.0f, 0.0f, Color.RED, 0.0f, 0.0f, Color.RED);
    final GradientPaint gp3 = new GradientPaint(0.0f, 0.0f, Color.RED, 0.0f, 0.0f, Color.RED);
    renderer.setSeriesPaint(0, gp0);
    renderer.setSeriesPaint(1, gp1);
    renderer.setSeriesPaint(2, gp2);
    renderer.setSeriesPaint(3, gp3);

    // OPTIONAL CUSTOMISATION COMPLETED.

    return chart;

}

From source file:com.ga.forms.DailyLogUI.java

private void updateAnalysis(ArrayList duration) {

    DailyLogAnalysis analysis = new DailyLogAnalysis();
    if (duration == null) {
        duration = new ArrayList();
    }/* w  ww .j a  v  a2 s. c  o  m*/
    analysis.analyse(duration);
    durationLbl.setText(analysis.getTotalDuration());
    monthlyDurationLbl.setText(analysis.getMonthlyDuration());
    int netDurationHours = Integer.parseInt(analysis.getTotalDuration().toString().split(":")[0]);
    int monthlyDurationHours = Integer.parseInt(analysis.getMonthlyDuration().toString().split(":")[0]);
    if (netDurationHours < monthlyDurationHours) {
        differenceLbl.setForeground(Color.red);
    } else {
        differenceLbl.setForeground(Color.green);
    }
    differenceLbl.setText(analysis.getDifference());
}

From source file:ega.projekt.graphDraw.DrawGraph.java

public static BasicVisualizationServer<Node, Edge> generatePanel(int panelWidth, int panelHeight) {
    DrawGraph graphView = new DrawGraph();
    Layout<Node, Edge> layout = new StaticLayout(graphView.drawGraph);
    for (Node n : graphView.drawGraph.getVertices()) {
        layout.setLocation(n, new java.awt.geom.Point2D.Double(n.getX(), n.getY()));
    }//from  w w  w.j  av a  2 s  . co m
    layout.setSize(new Dimension(panelWidth, panelHeight));
    BasicVisualizationServer<Node, Edge> vv = new BasicVisualizationServer<>(layout);
    vv.setPreferredSize(new Dimension(panelWidth, panelHeight));
    Transformer<Node, Paint> vertexPaint = new Transformer<Node, Paint>() {
        public Paint transform(Node i) {
            return Color.GREEN;
        }
    };
    final Stroke edgeStroke = new BasicStroke(1.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER);
    Transformer<Edge, Stroke> edgeStrokeTransformer = new Transformer<Edge, Stroke>() {
        public Stroke transform(Edge e) {
            return edgeStroke;
        }
    };
    vv.getRenderContext().setVertexFillPaintTransformer(vertexPaint);
    vv.getRenderContext().setEdgeStrokeTransformer(edgeStrokeTransformer);
    vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.QuadCurve<Node, Edge>());
    vv.getRenderContext().setEdgeLabelTransformer(new Transformer<Edge, String>() {
        public String transform(Edge e) {
            return (e.getFlowString() + "/" + Integer.toString(e.getCapacity()));
        }
    });
    vv.getRenderContext().setVertexLabelTransformer(new Transformer<Node, String>() {
        public String transform(Node n) {
            return (Integer.toString(n.getID()));
        }
    });
    vv.getRenderer().getVertexLabelRenderer().setPosition(Renderer.VertexLabel.Position.CNTR);
    return vv;
}

From source file:com.view.TimeSeriesChartView.java

public JFreeChart getTimeSeriesChart(Excel theExcel, ReceivingControl theRC) {

    System.out.println(theRC.getNumberOfItem());
    System.out.println(theRC.getNumberOfSite());
    System.out.println(theRC.getNumberOfVendor());
    System.out.println(theRC.getVendorInfo());
    System.out.println(theRC.getSiteInfo());
    System.out.println(theRC.getItemInfo());

    //        TimeSeries item1_xy_data = new TimeSeries("Item1");
    //        TimeSeries item2_xy_data = new TimeSeries("Item2");
    //        TimeSeries item3_xy_data = new TimeSeries("Item3");
    ArrayList<Receiving> theReceiving = theExcel.getSheetReceiving();

    //        HashMap<Month, Integer> item1Map = new HashMap<>();
    //        HashMap<Month, Integer> item2Map = new HashMap<>();
    //        HashMap<Month, Integer> item3Map = new HashMap<>();

    TimeSeries data[] = new TimeSeries[theRC.getNumberOfItem()];
    HashMap<Month, Integer> itemMap[] = new HashMap[theRC.getNumberOfItem()];
    for (int i = 0; i < theRC.getNumberOfItem(); i++) {
        String itemName = "item" + i;
        data[i] = new TimeSeries(itemName);
        itemMap[i] = new HashMap<>();
    }/*from   w w w  . ja v a  2  s  . c  o  m*/
    Calendar cal = Calendar.getInstance();
    for (int i = 0; i < theReceiving.size(); i++) {
        cal.setTime(theReceiving.get(i).getDate());
        int month = cal.get(Calendar.MONTH) + 1;
        int year = cal.get(Calendar.YEAR);
        int quantity = theReceiving.get(i).getQuantity();
        Month theMonth = new Month(month, year);
        int itemNum = theReceiving.get(i).getItem() - 1;
        itemMap[itemNum].put(theMonth, updateItemMap(itemMap[itemNum], theMonth, quantity));
        //            if (theReceiving[i].getItem() == 1)
        //            {
        //                item1Map.put(theMonth, updateItemMap(item1Map, theMonth, quantity));
        //            }
        //            else if (theReceiving[i].getItem() == 2)
        //            {
        //                item2Map.put(theMonth, updateItemMap(item2Map, theMonth, quantity));
        //            }
        //            else if (theReceiving[i].getItem() == 3)
        //            {
        //                item3Map.put(theMonth, updateItemMap(item3Map, theMonth, quantity));
        //            }
    }
    TimeSeriesCollection my_data_series = new TimeSeriesCollection();
    for (int i = 0; i < theRC.getNumberOfItem(); i++) {
        for (Map.Entry<Month, Integer> entry : itemMap[i].entrySet()) {
            data[i].add(entry.getKey(), entry.getValue());
        }
        my_data_series.addSeries(data[i]);
    }

    // add series using addSeries method
    //        my_data_series.addSeries(item1_xy_data);
    //        my_data_series.addSeries(item2_xy_data);
    //        my_data_series.addSeries(item3_xy_data);        
    JFreeChart chart = ChartFactory.createTimeSeriesChart("Receiving", "Month", "Quantity", my_data_series,
            true, true, false);
    chart.setBackgroundPaint(Color.YELLOW);
    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setBackgroundPaint(Color.WHITE);
    plot.setDomainGridlinePaint(Color.GREEN);
    plot.setRangeGridlinePaint(Color.orange);
    plot.setAxisOffset(new RectangleInsets(50, 0, 20, 5));
    plot.setDomainCrosshairVisible(true);
    plot.setRangeCrosshairVisible(true);

    XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer();

    renderer.setBaseShapesVisible(true);
    renderer.setBaseShapesFilled(true);

    DateAxis axis = (DateAxis) plot.getDomainAxis();
    axis.setDateFormatOverride(new SimpleDateFormat("MM.yyyy"));
    return chart;
}