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.jfree.chart.demo.GradientPaintTransformerDemo1.java

public static JPanel createDemoPanel() {
    JPanel jpanel = new JPanel(new GridLayout(2, 2));
    jpanel.setPreferredSize(new Dimension(800, 600));
    CategoryDataset categorydataset = createDataset();
    JFreeChart jfreechart = createChart("Type: VERTICAL", categorydataset);
    CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot();
    BarRenderer barrenderer = (BarRenderer) categoryplot.getRenderer();
    barrenderer.setDrawBarOutline(false);
    barrenderer.setSeriesPaint(0, new GradientPaint(0.0F, 0.0F, Color.red, 0.0F, 0.0F, Color.yellow));
    barrenderer.setSeriesPaint(1, new GradientPaint(0.0F, 0.0F, Color.blue, 0.0F, 0.0F, Color.green));
    barrenderer.setGradientPaintTransformer(
            new StandardGradientPaintTransformer(GradientPaintTransformType.VERTICAL));
    ChartPanel chartpanel = new ChartPanel(jfreechart);
    jpanel.add(chartpanel);//w ww  .j  a  v a  2 s.c o m
    JFreeChart jfreechart1 = createChart("Type: HORIZONTAL", categorydataset);
    CategoryPlot categoryplot1 = (CategoryPlot) jfreechart1.getPlot();
    BarRenderer barrenderer1 = (BarRenderer) categoryplot1.getRenderer();
    barrenderer1.setDrawBarOutline(false);
    barrenderer1.setSeriesPaint(0, new GradientPaint(0.0F, 0.0F, Color.red, 0.0F, 0.0F, Color.yellow));
    barrenderer1.setSeriesPaint(1, new GradientPaint(0.0F, 0.0F, Color.blue, 0.0F, 0.0F, Color.green));
    barrenderer1.setGradientPaintTransformer(
            new StandardGradientPaintTransformer(GradientPaintTransformType.HORIZONTAL));
    ChartPanel chartpanel1 = new ChartPanel(jfreechart1);
    jpanel.add(chartpanel1);
    JFreeChart jfreechart2 = createChart("Type: CENTER_VERTICAL", categorydataset);
    CategoryPlot categoryplot2 = (CategoryPlot) jfreechart2.getPlot();
    BarRenderer barrenderer2 = (BarRenderer) categoryplot2.getRenderer();
    barrenderer2.setDrawBarOutline(false);
    barrenderer2.setSeriesPaint(0, new GradientPaint(0.0F, 0.0F, Color.red, 0.0F, 0.0F, Color.yellow));
    barrenderer2.setSeriesPaint(1, new GradientPaint(0.0F, 0.0F, Color.blue, 0.0F, 0.0F, Color.green));
    barrenderer2.setGradientPaintTransformer(
            new StandardGradientPaintTransformer(GradientPaintTransformType.CENTER_VERTICAL));
    ChartPanel chartpanel2 = new ChartPanel(jfreechart2);
    jpanel.add(chartpanel2);
    JFreeChart jfreechart3 = createChart("Type: CENTER_HORIZONTAL", categorydataset);
    CategoryPlot categoryplot3 = (CategoryPlot) jfreechart3.getPlot();
    BarRenderer barrenderer3 = (BarRenderer) categoryplot3.getRenderer();
    barrenderer3.setDrawBarOutline(false);
    barrenderer3.setSeriesPaint(0, new GradientPaint(0.0F, 0.0F, Color.red, 0.0F, 0.0F, Color.yellow));
    barrenderer3.setSeriesPaint(1, new GradientPaint(0.0F, 0.0F, Color.blue, 0.0F, 0.0F, Color.green));
    barrenderer3.setGradientPaintTransformer(
            new StandardGradientPaintTransformer(GradientPaintTransformType.CENTER_HORIZONTAL));
    ChartPanel chartpanel3 = new ChartPanel(jfreechart3);
    jpanel.add(chartpanel3);
    return jpanel;
}

From source file:edu.jhuapl.graphs.jfreechart.BarEffectsTest.java

public static JFreeChartGraphSource getSource() throws GraphException {
    Map<String, Object> emptyMap = Collections.emptyMap();

    List<PointInterface> ps1 = new LinkedList<PointInterface>();
    ps1.add(new DataPoint(3, "Red", emptyMap));
    ps1.add(new DataPoint(5, "Green", emptyMap));
    ps1.add(new DataPoint(7, "Blue", emptyMap));

    Map<String, Object> s1Meta = new HashMap<String, Object>();
    s1Meta.put(GraphSource.SERIES_COLOR, Color.green);
    DataSeries s1 = new DataSeries(ps1, s1Meta);

    List<PointInterface> ps2 = new LinkedList<PointInterface>();

    Map<String, Object> redMap = new HashMap<String, Object>(1);
    redMap.put(GraphSource.ITEM_COLOR, Color.red);
    ps2.add(new DataPoint(5, "Red", redMap));

    Map<String, Object> greenMap = new HashMap<String, Object>(1);
    greenMap.put(GraphSource.ITEM_COLOR, Color.green);
    ps2.add(new DataPoint(2, "Green", greenMap));

    Map<String, Object> blueMap = new HashMap<String, Object>(1);
    blueMap.put(GraphSource.ITEM_COLOR, Color.blue);
    ps2.add(new DataPoint(14, "Blue", redMap));

    Map<String, Object> s2Meta = new HashMap<String, Object>();
    s2Meta.put(GraphSource.SERIES_COLOR, Color.orange);
    DataSeries s2 = new DataSeries(ps2, s2Meta);

    Map<String, Object> graphParams = new HashMap<String, Object>();
    graphParams.put(GraphSource.GRAPH_TYPE, GraphSource.GRAPH_TYPE_BAR);
    graphParams.put(JFreeChartBarGraphSource.PLOT_ORIENTATION, PlotOrientation.HORIZONTAL);
    graphParams.put(GraphSource.GRAPH_LEGEND, true);

    JFreeChartGraphSource source = new JFreeChartGraphSource();
    source.setData(Arrays.asList(s1, s2));
    source.setParams(graphParams);//from w  w w.j  a va2  s .  co  m
    source.initialize();

    return source;
}

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

private static JFreeChart createChart(TableXYDataset tablexydataset) {
    DateAxis dateaxis = new DateAxis("Year");
    dateaxis.setTickMarkPosition(DateTickMarkPosition.MIDDLE);
    dateaxis.setLowerMargin(0.01D);//from w ww  . j  ava2s. c o m
    dateaxis.setUpperMargin(0.01D);
    NumberAxis numberaxis = new NumberAxis("Tonnes");
    numberaxis.setNumberFormatOverride(new DecimalFormat("0.0%"));
    StackedXYBarRenderer stackedxybarrenderer = new StackedXYBarRenderer(0.29999999999999999D);
    stackedxybarrenderer.setRenderAsPercentages(true);
    GradientPaint gradientpaint = new GradientPaint(0.0F, 0.0F, new Color(64, 0, 0), 0.0F, 0.0F, Color.red);
    GradientPaint gradientpaint1 = new GradientPaint(0.0F, 0.0F, new Color(0, 64, 0), 0.0F, 0.0F, Color.green);
    stackedxybarrenderer.setSeriesPaint(0, gradientpaint);
    stackedxybarrenderer.setSeriesPaint(1, gradientpaint1);
    stackedxybarrenderer.setGradientPaintTransformer(
            new StandardGradientPaintTransformer(GradientPaintTransformType.HORIZONTAL));
    stackedxybarrenderer.setDrawBarOutline(false);
    stackedxybarrenderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator("{0} : {1} = {2} tonnes",
            new SimpleDateFormat("yyyy"), new DecimalFormat("#,##0")));
    XYPlot xyplot = new XYPlot(tablexydataset, dateaxis, numberaxis, stackedxybarrenderer);
    xyplot.setBackgroundPaint(Color.lightGray);
    xyplot.setDomainGridlinePaint(Color.white);
    xyplot.setRangeGridlinePaint(Color.white);
    JFreeChart jfreechart = new JFreeChart("Waste Management", xyplot);
    jfreechart.setBackgroundPaint(Color.white);
    jfreechart.addSubtitle(new TextTitle("St Albans City and District Council"));
    return jfreechart;
}

From source file:chart.XYChart.java

public XYChart(String applicationTitle, String chartTitle, double[] xData, double[] YDataAnalitic,
        double[] YDataNumerical1, double[] YDataNumerical2) {

    super(applicationTitle);

    JFreeChart xylineChart = ChartFactory.createXYLineChart(chartTitle, "", "",
            createDatasetForThree(xData, YDataAnalitic, YDataNumerical1, YDataNumerical2),
            PlotOrientation.VERTICAL, true, true, false);
    ChartPanel chartPanel = new ChartPanel(xylineChart);
    chartPanel.setPreferredSize(new java.awt.Dimension(560, 367));
    final XYPlot plot = xylineChart.getXYPlot();
    XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
    renderer.setSeriesPaint(0, Color.RED);
    renderer.setSeriesPaint(1, Color.GREEN);
    renderer.setSeriesPaint(2, Color.YELLOW);
    renderer.setSeriesPaint(3, Color.BLUE);
    renderer.setSeriesStroke(0, new BasicStroke(1.0f));
    renderer.setSeriesStroke(1, new BasicStroke(1.0f));
    renderer.setSeriesStroke(2, new BasicStroke(1.0f));
    renderer.setSeriesStroke(3, new BasicStroke(1.0f));
    plot.setRenderer(renderer);/*from www.java 2s.co m*/
    setContentPane(chartPanel);

    // panel.removeAll();
    //  panel.add(chartPanel);
    //  panel.validate();

}

From source file:userInterface.ManufactureRole.DecisionChartJPanel.java

private static JFreeChart createChart1(CategoryDataset categorydataset) {
    JFreeChart jfreechart = ChartFactory.createBarChart("Vaccine Sales", "Vaccine", "quantity", categorydataset,
            PlotOrientation.VERTICAL, true, true, false);
    CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot();
    categoryplot.setDomainGridlinesVisible(true);
    categoryplot.setRangeCrosshairVisible(true);
    categoryplot.setRangeCrosshairPaint(Color.blue);
    NumberAxis numberaxis = (NumberAxis) categoryplot.getRangeAxis();
    numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    BarRenderer barrenderer = (BarRenderer) categoryplot.getRenderer();
    barrenderer.setDrawBarOutline(false);
    GradientPaint gradientpaint = new GradientPaint(0.0F, 0.0F, Color.blue, 0.0F, 0.0F, new Color(0, 0, 64));
    GradientPaint gradientpaint1 = new GradientPaint(0.0F, 0.0F, Color.green, 0.0F, 0.0F, new Color(0, 64, 0));
    GradientPaint gradientpaint2 = new GradientPaint(0.0F, 0.0F, Color.red, 0.0F, 0.0F, new Color(64, 0, 0));
    barrenderer.setSeriesPaint(0, gradientpaint);
    barrenderer.setSeriesPaint(1, gradientpaint1);
    barrenderer.setSeriesPaint(2, gradientpaint2);
    barrenderer.setLegendItemToolTipGenerator(new StandardCategorySeriesLabelGenerator("Tooltip: {0}"));
    CategoryAxis categoryaxis = categoryplot.getDomainAxis();
    categoryaxis.setCategoryLabelPositions(
            CategoryLabelPositions.createUpRotationLabelPositions(0.52359877559829882D));
    return jfreechart;
}

From source file:edu.asu.mgb.gui.IndividualTransformer.java

@Override
public Transformer<State, Paint> getVertexPaintTransformer() {
    return new Transformer<State, Paint>() {
        @Override//from  w  w w.ja  v  a 2s.  co  m
        public Paint transform(State state) {
            boolean isInCorrect = state.isStudentCorrect(student);
            boolean isInWrong = state.isStudentWrong(student);
            if (isInCorrect) {
                return Color.GREEN;
            } else if (isInWrong) {
                return Color.RED;
            } else {
                return Color.WHITE;
            }
        }
    };
}

From source file:RendererSample.java

public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus,
        int row, int column) {
    Component renderer = DEFAULT_RENDERER.getTableCellRendererComponent(table, value, isSelected, hasFocus, row,
            column);/*w ww .j av a2 s .  com*/
    ((JLabel) renderer).setOpaque(true);
    Color foreground, background;
    if (isSelected) {
        foreground = Color.yellow;
        background = Color.green;
    } else {
        if (row % 2 == 0) {
            foreground = Color.blue;
            background = Color.white;
        } else {
            foreground = Color.white;
            background = Color.blue;
        }
    }
    renderer.setForeground(foreground);
    renderer.setBackground(background);
    return renderer;
}

From source file:Commander.Main.java

/**
 * Creates new form Main/*from w  w  w.j  av  a 2  s.  com*/
 */
public Main(java.awt.Frame parent, boolean modal) {
    super(parent, modal);

    //Set tranparant
    Color transparant = new Color(0, 0, 0, 0);
    setUndecorated(true);
    getRootPane().setOpaque(false);
    getContentPane().setBackground(transparant);
    setBackground(transparant);

    initComponents();

    //Set components transparant
    transparant = new Color(0, 0, 0, 1);
    txtCommand.setBackground(transparant);
    txtCommand.setForeground(Color.GREEN);
    txtCommand.setBorder(BorderFactory.createLineBorder(new Color(0, 0, 0, 150)));
    jScrollPane1.getViewport().setBackground(transparant);
    jScrollPane1.getViewport().setOpaque(false);
    txtError.setBackground(transparant);
    txtError.setForeground(Color.RED);
    txtError.setEditable(false);
    txtError.setFocusable(false);
    jScrollPane1.setVisible(false);
    setAlwaysOnTop(true);

    pack();
    Rectangle screen = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
    int width = getPreferredSize().width;
    int height = getPreferredSize().height;
    setLocation(screen.width - width - 20, screen.height - height - 20);

    txtCommand.getDocument().addDocumentListener(new DocumentListener() {

        @Override
        public void insertUpdate(DocumentEvent e) {
            if (jScrollPane1.isVisible()) {
                jScrollPane1.setVisible(false);
            }
        }

        @Override
        public void removeUpdate(DocumentEvent e) {
            if (jScrollPane1.isVisible()) {
                jScrollPane1.setVisible(false);
            }
        }

        @Override
        public void changedUpdate(DocumentEvent e) {
            //Not supported
        }

    });

    String home = System.getProperty("user.home");
    defaultLocations[0] = home + "/Documents";
    defaultLocations[1] = home + "/Pictures";
    defaultLocations[2] = home + "/Downloads";
    defaultLocations[3] = home + "/Music";

    //        run("Casino.jar", new ArrayList<>());
}

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

private static JFreeChart createChart(XYDataset xydataset) {
    JFreeChart jfreechart = ChartFactory.createXYLineChart("Marker Demo 2", "X", "Temperature", xydataset,
            PlotOrientation.VERTICAL, false, true, false);
    XYPlot xyplot = (XYPlot) jfreechart.getPlot();
    xyplot.setDomainGridlinePaint(Color.lightGray);
    xyplot.setDomainGridlineStroke(new BasicStroke(1.0F));
    xyplot.setRangeGridlinePaint(Color.lightGray);
    xyplot.setRangeGridlineStroke(new BasicStroke(1.0F));
    xyplot.setRangeTickBandPaint(new Color(240, 240, 240));
    PeriodAxis periodaxis = new PeriodAxis(null, new Hour(0, 30, 6, 2005), new Hour(23, 30, 6, 2005));
    PeriodAxisLabelInfo aperiodaxislabelinfo[] = new PeriodAxisLabelInfo[2];
    aperiodaxislabelinfo[0] = new PeriodAxisLabelInfo(org.jfree.data.time.Hour.class,
            new SimpleDateFormat("HH"));
    aperiodaxislabelinfo[1] = new PeriodAxisLabelInfo(org.jfree.data.time.Day.class,
            new SimpleDateFormat("dd-MMM"));
    periodaxis.setLabelInfo(aperiodaxislabelinfo);
    xyplot.setDomainAxis(periodaxis);//  w  w w. ja  va  2 s .  com
    ValueAxis valueaxis = xyplot.getRangeAxis();
    valueaxis.setRange(0.0D, 100D);
    XYItemRenderer xyitemrenderer = xyplot.getRenderer();
    xyitemrenderer.setSeriesPaint(0, Color.green);
    xyitemrenderer.setSeriesStroke(0, new BasicStroke(2.0F));
    ValueMarker valuemarker = new ValueMarker(80D);
    valuemarker.setLabelOffsetType(LengthAdjustmentType.EXPAND);
    valuemarker.setPaint(Color.red);
    valuemarker.setStroke(new BasicStroke(2.0F));
    valuemarker.setLabel("Temperature Threshold");
    valuemarker.setLabelFont(new Font("SansSerif", 0, 11));
    valuemarker.setLabelPaint(Color.red);
    valuemarker.setLabelAnchor(RectangleAnchor.TOP_LEFT);
    valuemarker.setLabelTextAnchor(TextAnchor.BOTTOM_LEFT);
    xyplot.addRangeMarker(valuemarker);
    Hour hour = new Hour(18, 30, 6, 2005);
    Hour hour1 = new Hour(20, 30, 6, 2005);
    double d = hour.getFirstMillisecond();
    double d1 = hour1.getFirstMillisecond();
    IntervalMarker intervalmarker = new IntervalMarker(d, d1);
    intervalmarker.setLabelOffsetType(LengthAdjustmentType.EXPAND);
    intervalmarker.setPaint(new Color(150, 150, 255));
    intervalmarker.setLabel("Automatic Cooling");
    intervalmarker.setLabelFont(new Font("SansSerif", 0, 11));
    intervalmarker.setLabelPaint(Color.blue);
    intervalmarker.setLabelAnchor(RectangleAnchor.TOP_LEFT);
    intervalmarker.setLabelTextAnchor(TextAnchor.TOP_RIGHT);
    xyplot.addDomainMarker(intervalmarker, Layer.BACKGROUND);
    ValueMarker valuemarker1 = new ValueMarker(d, Color.blue, new BasicStroke(2.0F));
    ValueMarker valuemarker2 = new ValueMarker(d1, Color.blue, new BasicStroke(2.0F));
    xyplot.addDomainMarker(valuemarker1, Layer.BACKGROUND);
    xyplot.addDomainMarker(valuemarker2, Layer.BACKGROUND);
    return jfreechart;
}

From source file:cl.almejo.vsim.gui.ColorScheme.java

public ColorScheme(String name) {
    _name = name;//w w  w.j av a  2 s  .c  o  m
    _colors.put("background", Color.GRAY);
    _colors.put("bus-on", Color.RED);
    _colors.put("gates", Color.BLUE);
    _colors.put("ground", Color.GREEN);
    _colors.put("off", Color.BLACK);
    _colors.put("wires-on", Color.RED);
    _colors.put("signal", Color.RED);
    _colors.put("grid", Color.GRAY);
    _colors.put("label", Color.YELLOW);
}