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:flexflux.analyses.result.TDRFBAResult.java

public void plot() {

    JPanel panel = new JPanel();
    JScrollPane sp = new JScrollPane(panel);
    panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS));

    // one chart by entity

    Color[] colors = new Color[] { Color.RED, Color.GREEN, Color.BLUE };
    int index = 0;
    for (String s : entities) {

        XYSeriesCollection dataset = new XYSeriesCollection();

        XYSeries series = new XYSeries(s);

        for (Double time : times) {
            series.add(time, resultMap.get(time).get(s));
        }//  w ww  .  j  a v a 2  s .c  o m

        final JFreeChart chart = ChartFactory.createXYLineChart(s, // chart
                // title
                "Time (h)", // domain axis label
                "Value", // range axis label
                dataset, // data
                PlotOrientation.VERTICAL, // orientation
                true, // include legend
                true, // tooltips
                false // urls
        );

        chart.setBackgroundPaint(Color.white);

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

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

        plot.getRenderer().setSeriesPaint(0, colors[index % colors.length]);

        index++;

        ChartPanel chartPanel = new ChartPanel(chart);

        dataset.addSeries(series);

        panel.add(chartPanel);
        panel.add(new JSeparator());

    }

    Dimension d = panel.getComponent(0).getPreferredSize();
    d.height *= 2;

    sp.getViewport().setPreferredSize(d);

    JFrame frame = new JFrame("Time-dependant FBA results");

    frame.add(sp);
    frame.pack();
    RefineryUtilities.centerFrameOnScreen(frame);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setVisible(true);

}

From source file:jmbench.plots.OperationsVersusSizePlot.java

public static Color getColor(int num) {
    switch (num) {
    case 0:/*from  www .  j  av  a  2  s . c om*/
        return new Color(0f, 0f, 1f, 0.6f);

    case 1:
        return new Color(0.5f, 0.7f, 0f, 0.6f);

    case 2:
        return Color.BLACK;

    case 3:
        return Color.RED;

    case 4:
        return Color.CYAN;

    case 5:
        return Color.ORANGE;

    case 6:
        return Color.GREEN;

    case 7:
        return Color.lightGray;

    case 8:
        return Color.blue;

    case 9:
        return new Color(255, 0, 255, 190); //magenta with translucent

    case 10:
        return new Color(230, 150, 0); // darker orange

    case 11:
        return new Color(255, 0, 255, 190);

    case 12:
        return new Color(120, 255, 0);

    default:
        throw new RuntimeException("add some more");
    }
}

From source file:com.xilinx.kintex7.PowerDial.java

public void createDial() {
    plot = new MeterPlot();
    dset = new DefaultValueDataset(0);
    plot.setUnits("Watts");
    plot.setRange(new Range(1, 10));
    plot.addInterval(new MeterInterval("Acceptable", new Range(1.0, 6.0), Color.lightGray,
            new BasicStroke(2.0f), Color.GREEN));
    plot.addInterval(new MeterInterval("Warning", new Range(6.0, 8.0), Color.lightGray, new BasicStroke(2.0f),
            Color.YELLOW));//  www  .j av a 2s.c om
    plot.addInterval(new MeterInterval("Dangerous", new Range(8.0, 10.0), Color.lightGray,
            new BasicStroke(2.0f), Color.RED));

    //sets different marks
    for (int i = 0; i < 10; i += 1) {
        if (i == 0)
            plot.addInterval(
                    new MeterInterval("", new Range(1, 1), Color.lightGray, new BasicStroke(2.0f), null));
        else
            plot.addInterval(
                    new MeterInterval("", new Range(i, i), Color.lightGray, new BasicStroke(2.0f), null));
    }
    plot.setNeedlePaint(Color.darkGray);
    plot.setDialBackgroundPaint(Color.white);
    plot.setDialOutlinePaint(Color.gray);
    plot.setDialShape(DialShape.PIE);
    plot.setMeterAngle(180);
    plot.setTickLabelsVisible(true);
    plot.setTickLabelFont(new Font("Dialog", Font.BOLD, 10));
    plot.setTickLabelPaint(Color.DARK_GRAY);
    plot.setTickSize(10.0);
    plot.setTickPaint(Color.lightGray);
    plot.setValuePaint(Color.BLACK);
    plot.setDataset(dset);

    LegendItemCollection legendItemsOld = plot.getLegendItems();
    final LegendItemCollection legendItemsNew = new LegendItemCollection();

    for (int i = 0; i < 3; i++) {
        LegendItem item = legendItemsOld.get(i);
        item.setLabelPaint(Color.WHITE);
        legendItemsNew.add(item);
    }

    LegendItemSource source = new LegendItemSource() {
        LegendItemCollection lic = new LegendItemCollection();
        {
            lic.addAll(legendItemsNew);
        }

        @Override
        public LegendItemCollection getLegendItems() {
            return lic;
        }
    };

    chart = new JFreeChart(plot);
    chart.addLegend(new LegendTitle(source));
    chart.removeLegend();
    chart.setTitle("");
    //chart.setBackgroundPaint(new GradientPaint(0,0,new Color(139,137,137),0,height,Color.BLUE ));
    //
    chart.getTitle().setPaint(Color.white);
    plot.setValueFont(new Font("Dialog", Font.BOLD, 14));
    //chartpanel = new ChartPanel(chart);
}

From source file:org.mwc.asset.netasset2.sensor2.VSensor.java

/**
 * Create the composite.//  w  w  w .  j a  v a  2  s.  c o m
 * 
 * @param parent
 * @param style
 */
public VSensor(final Composite parent, final int style) {
    super(parent, style);
    setLayout(new BorderLayout(0, 0));

    final ToolBar toolBar = new ToolBar(this, SWT.FLAT | SWT.RIGHT);
    toolBar.setLayoutData(BorderLayout.NORTH);

    // ToolItem testBtn = new ToolItem(toolBar, SWT.NONE);
    // testBtn.setText("Test 1");
    // testBtn.addSelectionListener(new SelectionAdapter()
    // {
    //
    // @Override
    // public void widgetSelected(SelectionEvent e)
    // {
    // doTest();
    // }
    // });

    final ToolItem tltmDropdownItem = new ToolItem(toolBar, SWT.DROP_DOWN);
    tltmDropdownItem.setText("Visible period");
    final DropdownSelectionListener drops = new DropdownSelectionListener(tltmDropdownItem);
    drops.add("5 Mins", 5 * 60);
    drops.add("15 Mins", 15 * 60);
    drops.add("60 Mins", 60 * 60);
    drops.add("All data", 0);
    tltmDropdownItem.addSelectionListener(drops);

    final Composite sashForm = new Composite(this, SWT.EMBEDDED);

    // now we need a Swing object to put our chart into
    final Frame _plotControl = SWT_AWT.new_Frame(sashForm);

    // the y axis is common to hi & lo res. Format it here
    final NumberAxis yAxis = new NumberAxis("Degs");
    //   yAxis.setRange(0, 360);
    yAxis.setAutoRange(true);
    yAxis.setTickUnit(new NumberTickUnit(45));

    // create a date-formatting axis
    _dateAxis = new RelativeDateAxis();
    _dateAxis.setStandardTickUnits(DateAxisEditor.createStandardDateTickUnitsAsTickUnits());
    _dateAxis.setAutoRange(true);

    final XYItemRenderer theRenderer = new XYShapeRenderer();

    _thePlot = new XYPlot(null, _dateAxis, yAxis, theRenderer);
    _thePlot.setOrientation(PlotOrientation.HORIZONTAL);
    _thePlot.setRangeAxisLocation(AxisLocation.TOP_OR_LEFT);
    _thePlot.setBackgroundPaint(Color.BLACK);
    theRenderer.setPlot(_thePlot);

    _dateAxis.setLabelPaint(Color.GREEN);
    _dateAxis.setTickLabelPaint(Color.GREEN);
    _dateAxis.setAxisLinePaint(Color.GREEN);

    yAxis.setLabelPaint(Color.GREEN);
    yAxis.setTickLabelPaint(Color.GREEN);

    _thePlotArea = new JFreeChart(null, _thePlot);
    _thePlotArea.setBackgroundPaint(Color.BLACK);
    _thePlotArea.setBorderPaint(Color.BLACK);

    // set the color of the area surrounding the plot
    // - naah, don't bother. leave it in the application background color.

    // ////////////////////////////////////////////////
    // put the holder into one of our special items
    // ////////////////////////////////////////////////
    _chartInPanel = new ChartPanel(_thePlotArea, true);

    _plotControl.add(_chartInPanel);

}

From source file:org.openmrs.module.vcttrac.web.view.chart.VCTCreateBarChartView.java

/**
 * Returns an array of paint objects that will be used for the bar colors.
 * //  w  w w . j av  a  2  s .co m
 * @return An array of paint objects.
 */
private static Paint[] createPaint() {
    Paint[] colors = new Paint[5];

    colors[0] = new GradientPaint(0.0f, 0.0f, Color.red, 0.0f, 0.0f, new Color(64, 0, 0));
    colors[1] = new GradientPaint(0.0f, 0.0f, Color.blue, 0.0f, 0.0f, new Color(0, 0, 64));
    colors[2] = new GradientPaint(0.0f, 0.0f, Color.green, 0.0f, 0.0f, new Color(0, 64, 0));
    colors[3] = new GradientPaint(0f, 0f, Color.orange, 0.0f, 0.0f, new Color(250, 128, 114));
    colors[4] = new GradientPaint(0f, 0f, Color.yellow, 0.0f, 0.0f, new Color(255, 215, 0));
    return colors;
}

From source file:com.syncleus.dann.graph.jung.BrainPanel.java

@Override
protected void initVis(VisualizationViewer<N, S> vis) {
    vis.getRenderContext().setVertexLabelTransformer(new NeuronLabeller());
    vis.getRenderContext().setEdgeLabelTransformer(new SynapseLabeller());
    vis.getRenderContext().setVertexFillPaintTransformer(new Transformer<N, Paint>() {

        public Paint transform(N n) {
            if (n instanceof InputNeuron) {
                return Color.MAGENTA;
            } else if (n instanceof OutputNeuron) {
                return Color.GREEN;
            } else {
                return Color.GRAY;
            }/*  w  w  w .  j a va2s. c o m*/
        }
    });
    vis.getRenderContext().setVertexShapeTransformer(new Transformer<N, Shape>() {

        public Shape transform(N n) {
            float s = 0.5f;
            if (n instanceof OutputNeuron) {
                OutputNeuron aan = (OutputNeuron) n;
                s = (float) Math.abs(aan.getOutput());
            } else if (n instanceof InputNeuron) {
                InputNeuron aan = (InputNeuron) n;
                s = (float) Math.abs(aan.getInput());
            }
            int w = (int) (s * 44.0);
            int h = (int) (s * 44.0);
            int x = -w / 2;
            int y = -h / 2;
            return new Rectangle2D.Float(x, y, w, h);
        }
    });
    vis.getRenderContext().setEdgeStrokeTransformer(new Transformer<S, Stroke>() {

        public Stroke transform(S i) {
            return new BasicStroke((int) ((Math.abs(i.getWeight())) * 8.0));
        }
    });
    vis.getRenderContext().setEdgeDrawPaintTransformer(new Transformer<S, Paint>() {

        public Paint transform(S syn) {
            float b = (float) Math.abs(syn.getWeight());
            float s = 0.8f;
            float h = syn.getWeight() < 0 ? 0.6f : 0.9f;
            return Color.getHSBColor(h, s, b);
        }
    });

}

From source file:j2se.jfreechart.barchart.BarChartDemo1.java

/**
 * Creates a sample chart./* w ww .j  a v  a2s  .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", // 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 = chart.getCategoryPlot();
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setDomainGridlinesVisible(true);
    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...
    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:de.quadrillenschule.azocamsyncd.astromode.gui.AstroModeJPanel.java

public void update() {
    int selectedRow = jobjTable.getSelectedRow();
    syncJobLists();//w  w  w.  j  a v  a 2s.  co  m

    if (jobList != null) {

        ((PhotoSeriesTableModel) jobjTable.getModel()).setPhotoSeries(jobList);
    }
    boolean somethingToConfirm = false;
    for (PhotoSerie ps : jobList) {
        if (ps.getTriggerStatus().equals(PhotoSerie.TriggerJobStatus.WAITFORUSER)) {
            confirmSPjButton.setBackground(Color.red);
            confirmSPjButton.setEnabled(true);
            somethingToConfirm = true;
        }
    }
    if (!somethingToConfirm) {
        confirmSPjButton.setBackground(addJobjButton.getBackground());
        confirmSPjButton.setEnabled(false);

    }
    ((PhotoSeriesTableModel) jobjTable.getModel()).fireTableDataChanged();
    smartPhoneStatus.setText(SmartPhoneWrapper.lastStatus().name());
    Color statusColor = Color.BLACK;
    switch (SmartPhoneWrapper.lastStatus()) {
    case CONNECTED:
        statusColor = Color.GREEN;
        break;
    case ERROR:
        statusColor = Color.RED;
        break;
    }
    smartPhoneStatus.setForeground(statusColor);
    try {
        if (SmartPhoneWrapper.getFromSmartPhone(WebService.WebCommands.jobprocessorstatus, true)
                .contains(JobProcessor.ProcessorStatus.PAUSED.name())) {
            pauseQueuejButton.setEnabled(false);
            startProcessorjButton.setEnabled(true);
        } else {
            pauseQueuejButton.setEnabled(true);
            startProcessorjButton.setEnabled(false);

        }
    } catch (IOException ex) {
        Logger.getLogger(AstroModeJPanel.class.getName()).log(Level.SEVERE, null, ex);
    }
    PROGRAMMATIC_SELECTION = true;
    jobjTable.getSelectionModel().setSelectionInterval(selectedRow, selectedRow);

    PROGRAMMATIC_SELECTION = false;
}

From source file:sanger.team16.gui.genevar.eqtl.snp.CisEQTLSNPPane2.java

private void setTranscriptPanel(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  w  w  w. j a  va2s .  c o  m*/

    //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 (transcriptTable.isEnabled()) {
        bSelectAll.setEnabled(false);
        bExport.setEnabled(false);
    }
    this.setTranscriptTable();

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

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

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

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

From source file:WeatherWizard.java

void setupText(String s1, String s2) {
    if (temperature <= 32) {
        textColor = Color.blue;/*from w  w  w . j  av  a2  s . c o m*/
        feels = "Freezing";
    } else if (temperature <= 50) {
        textColor = Color.green;
        feels = "Cold";
    } else if (temperature <= 65) {
        textColor = Color.yellow;
        feels = "Cool";
    } else if (temperature <= 75) {
        textColor = Color.orange;
        feels = "Warm";
    } else {
        textColor = Color.red;
        feels = "Hot";
    }
    condStr = s1;
    if (s2 != null) {
        condStr += "/" + s2;
    }
}