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.metacsp.utility.UI.PlotActivityNetworkGantt.java

/**
 * Create a new Gantt JFrame/*from   ww  w . j av  a  2 s.  c o m*/
 * @param s {@link ActivityNetworkSolver} to be plotted as Gantt
 * @param selectedVariables {@link Vector} of {@link ActivityNetworkSolver}'s component names (variable names) that will be plotted.
 * @param n {@link JFrame} title
 */
public PlotActivityNetworkGantt(ActivityNetworkSolver s, Vector<String> selectedVariables, String n) {
    super(n);
    this.solver = s;
    this.selectedVariables = selectedVariables;

    GanttRenderer renderer = new GanttRenderer();
    renderer.setBaseItemLabelFont(new Font("Tahoma", Font.PLAIN, 11));

    JFreeChart chart = ChartFactory.createGanttChart(null, // "Channel", //
            "Activities & Resources", // domain axis label
            null, // "Time", // range axis label
            createDataset(), // data
            false, // do not include legend
            false, // no tooltips
            false // urls
    );

    chart.getCategoryPlot().setRenderer(renderer);
    renderer.setSeriesPaint(0, Color.green.darker());
    renderer.setSeriesPaint(1, Color.red.darker());
    renderer.setItemMargin(-0.5);

    chart.getCategoryPlot().setRangeAxis(new NumberAxis());

    chart.getCategoryPlot().getRangeAxis().setLabelFont(new Font("Arial", Font.PLAIN, 14));
    chart.getCategoryPlot().getDomainAxis().setLabelFont(new Font("Arial", Font.PLAIN, 14));
    chart.getCategoryPlot().getDomainAxis().setTickLabelsVisible(true);
    chart.getCategoryPlot().getRangeAxis().setAutoRange(false);

    chartPanel = new ChartPanel(chart);
    chartPanel.setDomainZoomable(true);
    chartPanel.setRangeZoomable(true);

    setContentPane(new JScrollPane(chartPanel));
    this.setPreferredSize(new Dimension(800, 600));
    this.setSize(new Dimension(800, 600));
    this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    this.setVisible(true);
}

From source file:gov.llnl.lc.infiniband.opensm.plugin.graph.decorators.IB_EdgeFillTransformer.java

public Paint transform(IB_Edge e) {
    if (e.Decorator.Congestion)
        return Color.RED;
    if (e.Decorator.ForwardPath)
        return Color.GREEN;
    if (e.Decorator.ReturnPath)
        return Color.ORANGE;
    return null;//from  w  w w  .j a v  a2  s . c  o  m
}

From source file:Splash.java

public void paint(Graphics g) {
    im.paintIcon(this, g, 0, 0);
    g.setColor(Color.green);
    g.drawRoundRect(0, 0, getWidth() - 1, getHeight() - 1, 7, 7);
}

From source file:be.ac.ua.comp.scarletnebula.gui.AllGraphsPanel.java

/**
 * Places all components (graphs) in the panel.
 *//*  w  w  w .  j ava  2  s.  c o m*/
private void placeComponents() {
    final GridBagConstraints constraints = new GridBagConstraints();

    int numberOfComponentsPlaced = 0;
    int currXPos = 0;
    final int graphHeight = 150;
    final int graphWidth = 100;

    final Collection<String> datastreams = statisticsManager.getAvailableDatastreams();
    for (final String streamname : datastreams) {
        LOG.info("drawing stream");
        constraints.fill = GridBagConstraints.HORIZONTAL;
        constraints.weightx = 0.5;
        constraints.gridx = currXPos;
        constraints.gridy = numberOfComponentsPlaced / 2;
        constraints.insets = new Insets(10, 0, 0, 0);

        final DecoratedGraph graph = new DecoratedGraph((long) 10 * 60 * 1000,
                statisticsManager.getDatastream(streamname));
        graph.registerRelativeDatastream(server, streamname, Color.GREEN);
        graph.addServerToRefresh(server);
        final ChartPanel chartPanel = graph.getChartPanel();
        chartPanel.setPreferredSize(new Dimension(graphWidth, graphHeight));
        add(chartPanel, constraints);

        if (currXPos == 0) {
            currXPos = 1;
        } else {
            currXPos = 0;
        }
        numberOfComponentsPlaced++;
    }
}

From source file:org.jfree.expdemo.SelectionDemo3.java

private static JFreeChart createChart(XYDataset dataset, DatasetSelectionExtension ext) {
    JFreeChart chart = ChartFactory.createScatterPlot("SelectionDemo3", "X", "Y", dataset,
            PlotOrientation.VERTICAL, true, true, false);

    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setNoDataMessage("NO DATA");

    plot.setDomainPannable(true);//from   w ww.  jav a  2  s . c  om
    plot.setRangePannable(true);
    plot.setDomainZeroBaselineVisible(true);
    plot.setRangeZeroBaselineVisible(true);

    plot.setDomainGridlineStroke(new BasicStroke(0.0f));
    plot.setRangeGridlineStroke(new BasicStroke(0.0f));

    plot.setDomainMinorGridlinesVisible(true);
    plot.setRangeMinorGridlinesVisible(true);

    //XYItemRenderer r = plot.getRenderer();
    XYDotRenderer r = new XYDotRenderer();
    r.setDotHeight(2);
    r.setDotWidth(2);

    r.setSeriesPaint(0, Color.blue);
    r.setSeriesPaint(1, Color.green);
    r.setSeriesPaint(2, Color.yellow);
    r.setSeriesPaint(3, Color.orange);
    plot.setRenderer(r);
    NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis();
    domainAxis.setAutoRangeIncludesZero(false);

    domainAxis.setTickMarkInsideLength(2.0f);
    domainAxis.setTickMarkOutsideLength(2.0f);

    domainAxis.setMinorTickCount(2);
    domainAxis.setMinorTickMarksVisible(true);

    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setTickMarkInsideLength(2.0f);
    rangeAxis.setTickMarkOutsideLength(2.0f);
    rangeAxis.setMinorTickCount(2);
    rangeAxis.setMinorTickMarksVisible(true);

    //add selection specific rendering
    IRSUtilities.setSelectedItemPaint(r, ext, Color.red);

    //register plot as selection change listener
    ext.addSelectionChangeListener(plot);

    return chart;
}

From source file:com.charts.TenYearChart.java

public TenYearChart(YStockQuote currentStock) throws ParseException {
    DateAxis domainAxis = new DateAxis("Date");
    NumberAxis rangeAxis = new NumberAxis("Price");
    CandlestickRenderer renderer = new CandlestickRenderer();
    XYDataset dataset = getDataSet(currentStock);

    XYPlot mainPlot = new XYPlot(dataset, domainAxis, rangeAxis, renderer);

    //Do some setting up, see the API Doc
    renderer.setBaseToolTipGenerator(//from   www  .  jav  a2s. c  om
            new StandardXYToolTipGenerator(StandardXYToolTipGenerator.DEFAULT_TOOL_TIP_FORMAT,
                    new SimpleDateFormat("d-MMM-yyyy"), new DecimalFormat("0.00")));

    renderer.setDrawVolume(false);
    rangeAxis.setAutoRangeIncludesZero(false);

    domainAxis.setDateFormatOverride(new SimpleDateFormat("dd-MM-yy"));
    domainAxis.setTickMarkPosition(DateTickMarkPosition.MIDDLE);

    //Now create the chart and chart panel
    JFreeChart chart = new JFreeChart(currentStock.get_name(), null, mainPlot, false);

    chartPanel = new ChartPanel(chart);
    chartPanel.setPreferredSize(new Dimension(900, 400));

    XYPlot plot = (XYPlot) chart.getPlot();
    LegendTitle legend = new LegendTitle(plot);
    chart.addLegend(legend);
    chart.getLegend().setVisible(true);
    chart.getLegend().setPosition(RectangleEdge.BOTTOM);

    ValueAxis yAxis = (ValueAxis) plot.getRangeAxis();
    DateAxis xAxis = (DateAxis) plot.getDomainAxis();

    xAxis.setDateFormatOverride(new SimpleDateFormat("MMM y"));
    xAxis.setAutoTickUnitSelection(true);
    xAxis.setAutoRange(true);
    renderer.setAutoWidthFactor(0.5);
    renderer.setUpPaint(Color.green);
    renderer.setDownPaint(new Color(0xc0, 0x00, 0x00));
    renderer.setSeriesPaint(0, Color.BLACK);
    StandardXYItemRenderer renderer1 = new StandardXYItemRenderer();
    renderer1.setSeriesPaint(0, Color.BLUE);
    TimeSeries movingAverage30 = MovingAverage.createMovingAverage(close, "MA(30)", 30, 0);
    Double currMA30 = (Double) movingAverage30.getDataItem(movingAverage30.getItemCount() - 1).getValue();
    currMA30 = Math.round(currMA30 * 100.0) / 100.0;
    movingAverage30.setKey("MA(30): " + currMA30);
    TimeSeriesCollection collection = new TimeSeriesCollection();
    collection.addSeries(movingAverage30);
    plot.setDataset(1, collection);
    plot.setRenderer(1, renderer1);

    chartPanel.revalidate();
    chartPanel.repaint();
    chartPanel.revalidate();
    chartPanel.repaint();
}

From source file:com.okmich.twitanalysis.gui.ApplicationFrame.java

private void setChartPanel(JPanel jpanel) {
    this.negativeSeries = new TimeSeries("Negative", Millisecond.class);
    this.postiveSeries = new TimeSeries("Positive", Millisecond.class);
    this.neutralSeries = new TimeSeries("Neutral", Millisecond.class);
    final TimeSeriesCollection dataset = new TimeSeriesCollection(this.negativeSeries);
    dataset.addSeries(this.postiveSeries);
    dataset.addSeries(this.neutralSeries);
    final JFreeChart chart = createChart(dataset);
    chart.getXYPlot().getRenderer(0).setSeriesPaint(0, Color.RED);
    chart.getXYPlot().getRenderer(0).setSeriesStroke(0, new BasicStroke(2.0f));
    chart.getXYPlot().getRenderer(0).setSeriesPaint(1, Color.GREEN);
    chart.getXYPlot().getRenderer(0).setSeriesStroke(1, new BasicStroke(2.0f));
    chart.getXYPlot().getRenderer(0).setSeriesPaint(2, Color.GRAY);
    chart.getXYPlot().getRenderer(0).setSeriesStroke(2, new BasicStroke(2.0f));
    chart.getPlot().setBackgroundPaint(Color.BLACK);

    final ChartPanel chartPanel = new ChartPanel(chart);

    final JPanel tweetCountPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));

    tweetCountLabel = new JLabel();
    setTweetCountLabel();//from   w  w  w  .j  a va  2 s.c om
    tweetCountPanel.add(tweetCountLabel);

    jpanel.setLayout(new BorderLayout(10, 10));
    jpanel.add(chartPanel, BorderLayout.CENTER);
    jpanel.add(tweetCountPanel, BorderLayout.SOUTH);
    chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
    setContentPane(jpanel);
}

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

/**
 * Creates a sample chart.// ww  w.j  av a 2 s .  co m
 *
 * @param dataset  a dataset.
 *
 * @return The chart.
 */
private static JFreeChart createChart(CategoryDataset dataset) {

    JFreeChart chart = ChartFactory.createLineChart("Statistical Bar Chart Demo 1", "Type", "Value", 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:com.googlecode.logVisualizer.chart.HorizontalIntervallBarChartBuilder.java

private JFreeChart createChart(final CategoryDataset dataset) {
    final JFreeChart chart = ChartFactory.createBarChart(getTitle(), xLable, yLable, dataset,
            PlotOrientation.HORIZONTAL, isIncludeLegend(), true, false);
    final CategoryPlot plot = (CategoryPlot) chart.getPlot();
    final CategoryAxis categoryAxis = plot.getDomainAxis();
    final LayeredBarRenderer renderer = new LayeredBarRenderer();

    plot.setBackgroundPaint(Color.white);
    plot.setDomainGridlinesVisible(false);
    plot.setRangeGridlinePaint(Color.black);
    setBarShadowVisible(chart, false);//w w  w .j  av  a  2  s  .com

    plot.getRangeAxis().setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    plot.getRangeAxis().setLowerBound(-35);
    plot.getRangeAxis().setUpperBound(35);

    renderer.setDrawBarOutline(false);
    renderer.setSeriesPaint(0, Color.blue);
    renderer.setSeriesPaint(1, Color.green);
    renderer.setBaseItemLabelsVisible(true);
    renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
    renderer.setSeriesPositiveItemLabelPosition(0,
            new ItemLabelPosition(ItemLabelAnchor.OUTSIDE3, TextAnchor.CENTER));
    renderer.setSeriesPositiveItemLabelPosition(1,
            new ItemLabelPosition(ItemLabelAnchor.OUTSIDE2, TextAnchor.CENTER));
    renderer.setSeriesNegativeItemLabelPosition(0,
            new ItemLabelPosition(ItemLabelAnchor.OUTSIDE9, TextAnchor.CENTER));
    renderer.setSeriesNegativeItemLabelPosition(1,
            new ItemLabelPosition(ItemLabelAnchor.OUTSIDE10, TextAnchor.CENTER));
    renderer.setItemLabelAnchorOffset(9.0);
    renderer.setBaseToolTipGenerator(
            new StandardCategoryToolTipGenerator("{1}, {2}", NumberFormat.getInstance()));
    plot.setRenderer(renderer);
    plot.setRowRenderingOrder(SortOrder.DESCENDING);

    categoryAxis.setCategoryMargin(0.15);
    categoryAxis.setUpperMargin(0.0175);
    categoryAxis.setLowerMargin(0.0175);

    return chart;
}

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

private JFreeChart createChart(String title, CategoryDataset dataset) {
    JFreeChart chart = ChartFactory.createBarChart(title, "Benchmark (Iteration/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 w  w.j a va 2 s .  c  om
    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;
}