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:sanger.team16.gui.genevar.mqtl.snp.CisMQTLSNPPane2.java

private void setMofidicationPanel(String variationName, ChartPanel regionalLinePlot)
        throws ArrayIndexOutOfBoundsException {
    BaseJPane panel = new BaseJPane(variationName, 10, 20, 10, 20);

    // ------------------ Panel p0 (start) ------------------ //
    BaseJPane p0 = new BaseJPane();

    p0.add(regionalLinePlot);/*from ww w. j av  a2 s .c  om*/

    //p0.setBaseSpringBoxTrailing();
    panel.add(p0);
    // ------------------ Panel p0 (end) ------------------ //

    panel.add(new JLabel(""));
    panel.add(new JLabel(""));
    panel.add(new JLabel(""));

    // ------------------ Panel p1 (start) ------------------ //
    BaseJPane p1 = new BaseJPane();

    JButton bSelectAll = new JButton(" Deselect All ");
    JButton bExport = new JButton("  Export List  ");
    CisSNPPane2Listener cisSNP2Listener = new CisSNPPane2Listener(bSelectAll, bExport);

    //bSelectAll.setForeground(new Color(34,139,34));
    bSelectAll.setForeground(Color.GREEN.darker());
    bSelectAll.addActionListener(cisSNP2Listener);
    p1.add(bSelectAll);

    bExport.addActionListener(cisSNP2Listener);
    p1.add(bExport);

    p1.add(Box.createHorizontalGlue());
    this.setLinkToPanel(p1, assemblyId, snp.getChromosome(), snp.getPosition(), distanceToSNP);

    p1.setBaseSpringBox();
    panel.add(p1);
    // ------------------ Panel p1 (end) ------------------ //

    // ------------------ Panel p2 (start) ------------------ //
    //BaseJTable transcriptTable = this.transcriptTable.getSortedTable();   //TODO
    if (modificationTable.isEnabled()) {
        bSelectAll.setEnabled(false);
        bExport.setEnabled(false);
    }
    this.setTranscriptTable();

    BaseJPane p2 = new BaseJPane();
    p2.setLayout(new BorderLayout());
    p2.add(modificationTable.getTableHeader(), BorderLayout.PAGE_START);
    p2.add(modificationTable, BorderLayout.CENTER);

    //p0.setBaseSpringGrid(1, 1);
    panel.add(p2);
    // ------------------ Panel p2 (end) ------------------ //

    panel.add(new JLabel(" (Use CTRL+C to copy CpG probes of interest)"));

    panel.setBaseSpringGrid(1);
    this.add(panel);
}

From source file:guineu.modules.dataanalysis.correlations.CorrelationTask.java

@Override
public void run() {
    setStatus(TaskStatus.PROCESSING);//w w  w .  j  a  v a  2  s . com
    try {
        Dataset data1 = dataset[0];
        Dataset data2 = null;
        if (dataset.length == 1) {
            data2 = dataset[0];
        } else if (dataset.length > 1) {
            data2 = dataset[1];
        }
        Dataset newDataset = new SimpleBasicDataset("Correlation matrix");
        newDataset.addColumnName("ID");

        // Column names from the first dataset
        for (PeakListRow row : data1.getRows()) {
            String name = row.getID() + " - " + row.getName();
            newDataset.addColumnName(name);
            if (this.showPvalue) {
                newDataset.addColumnName(name + " - pValue");
            }
        }

        // Row names from the second dataset
        for (int i = 0; i < data2.getNumberRows(); i++) {
            PeakListRow row = data2.getRow(i);
            PeakListRow newRow = new SimplePeakListRowOther();
            newRow.setPeak("ID", row.getID() + " - " + row.getName());
            newDataset.addRow(newRow);
        }

        for (PeakListRow row : data1.getRows()) {
            String name = row.getID() + " - " + row.getName();
            String pValueName = name + " - pValue";
            for (int i = 0; i < data2.getNumberRows(); i++) {
                RealMatrix matrix = getCorrelation(row, data2.getRow(i), data1.getAllColumnNames());
                PearsonsCorrelation correlation = null;
                if (this.correlationType.contains("Pearsons")) {
                    correlation = new PearsonsCorrelation(matrix);
                } else if (this.correlationType.contains("Spearmans")) {
                    SpearmansCorrelation scorrelation = new SpearmansCorrelation(matrix);
                    correlation = scorrelation.getRankCorrelation();
                }
                if (correlation != null) {
                    double c = correlation.getCorrelationMatrix().getEntry(1, 0);
                    double p = correlation.getCorrelationPValues().getEntry(1, 0);
                    String cp = String.valueOf(c);

                    Color cell = Color.WHITE;
                    if (p < cutoff) {
                        if (c < 0) {
                            cell = Color.green;
                        } else {
                            cell = Color.red;
                        }

                    }
                    int pColumnIndex = 0;
                    if (this.showPvalue) {
                        newDataset.getRow(i).setPeak(pValueName, String.valueOf(p));
                        pColumnIndex = newDataset.getAllColumnNames().indexOf(pValueName) + 2;
                        newDataset.setCellColor(cell, i, pColumnIndex);
                    }

                    pColumnIndex = newDataset.getAllColumnNames().indexOf(name) + 2;
                    newDataset.getRow(i).setPeak(name, cp);

                    newDataset.setCellColor(cell, i, pColumnIndex);

                }

                if (this.correlationType.contains("Covariance")) {
                    Covariance covariance = new Covariance(matrix);
                    double c = covariance.getCovarianceMatrix().getEntry(1, 0);
                    newDataset.getRow(i).setPeak(name, String.valueOf(c));
                }
            }
        }

        GUIUtils.showNewTable(newDataset, true);
        setStatus(TaskStatus.FINISHED);
    } catch (Exception ex) {
        Logger.getLogger(CorrelationTask.class.getName()).log(Level.SEVERE, null, ex);
        setStatus(TaskStatus.ERROR);
    }
}

From source file:com.joey.software.memoryToolkit.MemoryUsagePanel.java

/**
 * Creates a new application.//from w  ww. j  a v a 2  s .com
 * 
 * @param historyCount
 *            the history count (in milliseconds).
 */
public MemoryUsagePanel(int historyCount, int interval) {
    super(new BorderLayout());
    // create two series that automatically discard data more than 30
    // seconds old...
    this.total = new TimeSeries("Total Memory", Millisecond.class);
    this.total.setMaximumItemCount(historyCount);
    this.free = new TimeSeries("Free Memory", Millisecond.class);
    this.free.setMaximumItemCount(historyCount);
    this.used = new TimeSeries("Used Memory", Millisecond.class);
    this.used.setMaximumItemCount(historyCount);
    this.max = new TimeSeries("Used Memory", Millisecond.class);
    this.max.setMaximumItemCount(historyCount);
    TimeSeriesCollection dataset = new TimeSeriesCollection();
    dataset.addSeries(this.total);
    dataset.addSeries(this.free);
    dataset.addSeries(this.used);
    dataset.addSeries(this.max);

    DateAxis domain = new DateAxis("Time");
    NumberAxis range = new NumberAxis("Memory");

    domain.setTickLabelFont(new Font("SansSerif", Font.PLAIN, 12));
    range.setTickLabelFont(new Font("SansSerif", Font.PLAIN, 12));
    domain.setLabelFont(new Font("SansSerif", Font.PLAIN, 14));

    range.setLabelFont(new Font("SansSerif", Font.PLAIN, 14));
    XYItemRenderer renderer = new XYLineAndShapeRenderer(true, false);
    renderer.setSeriesPaint(0, Color.red);
    renderer.setSeriesPaint(1, Color.green);
    renderer.setSeriesPaint(2, Color.black);

    renderer.setStroke(new BasicStroke(1f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL));
    XYPlot plot = new XYPlot(dataset, domain, range, renderer);
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
    domain.setAutoRange(true);
    domain.setLowerMargin(0.0);
    domain.setUpperMargin(0.0);
    domain.setTickLabelsVisible(true);
    range.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    JFreeChart chart = new JFreeChart("JVM Memory Usage", new Font("SansSerif", Font.BOLD, 24), plot, true);
    chart.setBackgroundPaint(Color.white);
    ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4),
            BorderFactory.createLineBorder(Color.black)));
    add(chartPanel);

    gen = new DataGenerator(interval);

}

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

/**
 * Creates a sample chart./* ww  w  .  ja va  2s .com*/
 * 
 * @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, !legendPanelOn, // 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(0xBBBBDD));

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

    // 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.setMaximumBarWidth(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);
    renderer.setSeriesPaint(0, gp0);
    renderer.setSeriesPaint(1, gp1);

    // OPTIONAL CUSTOMISATION COMPLETED.
    renderer.setLegendItemLabelGenerator(new SOCRCategorySeriesLabelGenerator());
    setCategorySummary(dataset);
    return chart;

}

From source file:de.fub.maps.project.plugins.tasks.eval.OverviewChart.java

private void initRenderer(CategoryItemRenderer renderer) {
    Color[] colors = new Color[] { Color.red, Color.blue, Color.orange, Color.cyan, Color.yellow, Color.magenta,
            Color.green, Color.pink, Color.black, Color.gray };

    if (!this.roadNetworkStatisticsList.isEmpty()) {
        for (int i = 0; i < this.roadNetworkStatisticsList.size(); i++) {
            renderer.setSeriesPaint(i, colors[i % colors.length]);
        }/*www . j av a 2s .c  om*/
    }
}

From source file:eu.planets_project.tb.impl.chart.ExperimentExecutionCharts.java

public JFreeChart createXYChart(String expId) {
    ExperimentPersistencyRemote edao = ExperimentPersistencyImpl.getInstance();
    long eid = Long.parseLong(expId);
    log.info("Building experiment chart for eid = " + eid);
    Experiment exp = edao.findExperiment(eid);

    final DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    final String expName = exp.getExperimentSetup().getBasicProperties().getExperimentName();
    List<Boolean> success = new ArrayList<Boolean>();

    for (BatchExecutionRecordImpl batch : exp.getExperimentExecutable().getBatchExecutionRecords()) {
        int i = 1;
        for (ExecutionRecordImpl exr : batch.getRuns()) {
            //log.info("Found Record... "+exr+" stages: "+exr.getStages());
            if (exr != null && exr.getStages() != null) {
                // Look up the object, so we can get the name.
                DigitalObjectRefBean dh = new DataHandlerImpl().get(exr.getDigitalObjectReferenceCopy());
                String dobName = "Object " + i;
                if (dh != null)
                    dobName = dh.getName();

                for (ExecutionStageRecordImpl exsr : exr.getStages()) {
                    Double time = exsr.getDoubleMeasurement(TecRegMockup.PROP_SERVICE_TIME);
                    // Look for timing:
                    if (time != null) {
                        dataset.addValue(time, expName, dobName);
                        if (exsr.isMarkedAsSuccessful()) {
                            success.add(Boolean.TRUE);
                        } else {
                            success.add(Boolean.FALSE);
                        }//  w w  w .ja v a2  s  .  co  m
                    }
                }
            }
            // Increment, for the next run.
            i++;
        }
    }

    // Create the chart.
    JFreeChart chart = ChartFactory.createBarChart(null, "Digital Object", "Time [s]", dataset,
            PlotOrientation.VERTICAL, true, true, false);

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

    Paint[] customColours = new Paint[success.size()];
    for (int i = 0; i < success.size(); i++) {
        Boolean b = success.get(i);
        if (Boolean.TRUE.equals(b)) {
            customColours[i] = Color.GREEN;
        } else {
            customColours[i] = Color.RED;
        }
    }
    CategoryItemRenderer renderer = new CustomRenderer(customColours);

    // disable bar outlines...
    //final BarRenderer renderer = (BarRenderer) plot.getRenderer();
    //renderer.setDrawBarOutline(false);
    plot.setRenderer(renderer);

    // set up gradient paints for series...
    final GradientPaint gp0 = new GradientPaint(0.0f, 0.0f, Color.blue, 0.0f, 0.0f, Color.blue);
    final GradientPaint gp1 = new GradientPaint(0.0f, 0.0f, Color.red, 0.0f, 0.0f, Color.pink);
    final GradientPaint gp2 = new GradientPaint(0.0f, 0.0f, Color.green, 0.0f, 0.0f, Color.lightGray);
    renderer.setSeriesPaint(0, gp0);
    renderer.setSeriesPaint(1, gp1);
    renderer.setSeriesPaint(2, gp2);

    // Set the tooltips...
    renderer.setBaseItemURLGenerator(new StandardCategoryURLGenerator("xy_chart.jsp", "series", "section"));
    renderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator());

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

    return chart;
}

From source file:com.thalesgroup.hudson.plugins.cccc.CcccChartBuilder.java

protected JFreeChart createGraph() {

    JFreeChart chart = ChartFactory.createStackedAreaChart(null, null, "Number of modules",
            buildDataset(action), PlotOrientation.VERTICAL, true, false, true);

    chart.setBackgroundPaint(Color.white);

    CategoryPlot plot = chart.getCategoryPlot();
    plot.setBackgroundPaint(Color.WHITE);
    plot.setOutlinePaint(null);/*  ww w  .ja  va  2  s . co m*/
    plot.setForegroundAlpha(0.8f);
    plot.setRangeGridlinesVisible(true);
    plot.setRangeGridlinePaint(Color.black);

    CategoryAxis domainAxis = new ShiftedCategoryAxis(null);
    plot.setDomainAxis(domainAxis);
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
    domainAxis.setLowerMargin(0.0);
    domainAxis.setUpperMargin(0.0);
    domainAxis.setCategoryMargin(0.0);

    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    // crop extra space around the graph
    plot.setInsets(new RectangleInsets(0, 0, 0, 5.0));

    CategoryItemRenderer firstRender = new DefaultCategoryItemRenderer();
    CcccAreaRenderer renderer = new CcccAreaRenderer(action.getUrlName());
    plot.setRenderer(firstRender);

    //Second
    NumberAxis axis2 = new NumberAxis("Lines of Code");
    axis2.setLabelPaint(Color.BLUE);
    axis2.setAxisLinePaint(Color.BLUE);
    axis2.setTickLabelPaint(Color.BLUE);
    CategoryPlot categoryPlot = chart.getCategoryPlot();
    categoryPlot.setRangeAxis(1, axis2);
    //CategoryAxis categoryAxis = categoryPlot.getDomainAxis();
    categoryPlot.setDataset(1, buildDataset2(action));
    categoryPlot.mapDatasetToRangeAxis(1, 1);
    CategoryItemRenderer rendu = new DefaultCategoryItemRenderer();
    rendu.setBasePaint(Color.BLUE);
    categoryPlot.setRenderer(1, rendu);

    //Third
    NumberAxis axis3 = new NumberAxis("McCabe's Cyclomatic Number");
    axis3.setLabelPaint(Color.GREEN);
    axis3.setAxisLinePaint(Color.GREEN);
    axis3.setTickLabelPaint(Color.GREEN);
    CategoryPlot categoryPlot3 = chart.getCategoryPlot();
    categoryPlot3.setRangeAxis(2, axis3);
    categoryPlot3.setDataset(2, buildDataset3(action));
    categoryPlot3.mapDatasetToRangeAxis(2, 2);
    categoryPlot3.mapDatasetToDomainAxis(2, 0);
    CategoryItemRenderer rendu3 = new DefaultCategoryItemRenderer();
    rendu3.setBasePaint(Color.GREEN);
    categoryPlot3.setRenderer(2, rendu3);

    return chart;
}

From source file:com.twocents.report.charts.BarChartDemo1.java

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

    // create the chart...
    JFreeChart chart = ChartFactory.createBarChart("Bar Chart Demo 1", // chart title
            "Category", // domain axis label
            "Value", // range axis label
            dataset, // data
            PlotOrientation.VERTICAL, // orientation
            true, // 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 = (CategoryPlot) chart.getPlot();

    // ******************************************************************
    //  More than 150 demo applications are included with the JFreeChart
    //  Developer Guide...for more information, see:
    //
    //  >   http://www.object-refinery.com/jfreechart/guide.html
    //
    // ******************************************************************

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

    // 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));
    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));
    // OPTIONAL CUSTOMISATION COMPLETED.

    return chart;

}

From source file:rod_design_compute.ShowPanel.java

private void paintSR(SR rodSR, Graphics g) {
    Graphics2D g2d = (Graphics2D) g;
    g2d.setStroke(new BasicStroke(2f));

    if (rodSR.flag == true) {
        g2d.setColor(Color.red);/*from w ww .  j a  va  2  s .  c o  m*/
        g.drawLine(toScreenX(rodSR.getPointA().X), toScreenY(rodSR.getPointA().Y),
                toScreenX(rodSR.getPointE().X), toScreenY(rodSR.getPointE().Y));
        g.drawLine(toScreenX(rodSR.getPointB().X), toScreenY(rodSR.getPointB().Y),
                toScreenX(rodSR.getPointE().X), toScreenY(rodSR.getPointE().Y));
        drawOtherPoint(rodSR.getPointE(), g);
        g2d.setColor(Color.black);
    }

    g2d.setColor(Color.green);
    g.drawLine(toScreenX(rodSR.getPointA().X), toScreenY(rodSR.getPointA().Y), toScreenX(rodSR.getPointB().X),
            toScreenY(rodSR.getPointB().Y));
    g2d.setColor(Color.black);

    drawBasePoint(rodSR.getPointA(), g);
    drawJunctionPoint(rodSR.getPointB(), g);
}

From source file:lab10part2.Chart.java

private JFreeChart createChart(final CategoryDataset dataset) {

    // create the chart...
    final JFreeChart chart = ChartFactory.createBarChart("Bar Chart Demo", // chart title
            "Category", // domain axis label
            "Value", // range axis label
            dataset, // data
            PlotOrientation.VERTICAL, // orientation
            true, // include legend
            true, // tooltips?
            false // URLs?
    );/*w  w w.  ja  v  a  2  s.  com*/

    // 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));
    // OPTIONAL CUSTOMISATION COMPLETED.

    return chart;

}