List of usage examples for java.awt Color green
Color green
To view the source code for java.awt Color green.
Click Source Link
From source file:TextureWithBufferedImage.java
public void paint(Graphics g) { Graphics2D g2D = (Graphics2D) g; Rectangle2D rec1, rec2, rec3, rec4, rec5; rec1 = new Rectangle2D.Float(25, 25, 75, 150); rec2 = new Rectangle2D.Float(125, 25, 10, 75); rec3 = new Rectangle2D.Float(75, 125, 125, 75); rec4 = new Rectangle2D.Float(25, 15, 12, 75); rec5 = new Rectangle2D.Float(15, 50, 15, 15); AlphaComposite ac = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1); g2D.setComposite(ac);/*from w w w . j a va 2 s. c om*/ g2D.setStroke(new BasicStroke(5.0f)); g2D.draw(rec1); GradientPaint gp = new GradientPaint(125f, 25f, Color.yellow, 225f, 100f, Color.blue); g2D.setPaint(gp); g2D.fill(rec2); BufferedImage bi = new BufferedImage(5, 5, BufferedImage.TYPE_INT_RGB); Graphics2D big = bi.createGraphics(); big.setColor(Color.magenta); big.fillRect(0, 0, 5, 5); big.setColor(Color.black); big.drawLine(0, 0, 5, 5); Rectangle r = new Rectangle(0, 0, 5, 5); TexturePaint tp = new TexturePaint(bi, r); g2D.setPaint(tp); g2D.fill(rec3); g2D.setColor(Color.green); g2D.fill(rec4); g2D.setColor(Color.red); g2D.fill(rec5); }
From source file:userInterface.StateAdminRole.DecisionChart4JPanel.java
private static JFreeChart createChart1(CategoryDataset categorydataset) { JFreeChart jfreechart = ChartFactory.createBarChart("Total Vaccinations", "Hospital", "Value", 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:org.jfree.chart.demo.DeviationRendererDemo3.java
private static JFreeChart createChart(XYDataset xydataset) { JFreeChart chart = ChartFactory.createXYLineChart("DeviationRenderer - Demo 3", "X", "Y", xydataset, PlotOrientation.VERTICAL, false, true, false); XYPlot plot = (XYPlot) chart.getPlot(); ////from www .j a va 2 s . com DeviationRenderer renderer = new DeviationRenderer(false, false); renderer.setSeriesStroke(0, new BasicStroke(3F, 1, 1)); renderer.setSeriesStroke(0, new BasicStroke(3F, 1, 1)); renderer.setSeriesStroke(1, new BasicStroke(3F, 1, 1)); renderer.setSeriesFillPaint(0, Color.red); renderer.setSeriesFillPaint(1, Color.orange); renderer.setSeriesFillPaint(2, Color.green); plot.setRenderer(renderer); // DateAxis domainAxis = new DateAxis("Date"); domainAxis.setLowerMargin(0.0D); domainAxis.setUpperMargin(0.0D); plot.setDomainAxis(domainAxis); NumberAxis valueAxis = (NumberAxis) plot.getRangeAxis(); valueAxis.setRange(-40D, 40D); valueAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); ChartUtilities.applyCurrentTheme(chart); return chart; }
From source file:userInterface.StateAdminRole.DecisionCartJPanel2.java
private static JFreeChart createChart1(CategoryDataset categorydataset) { JFreeChart jfreechart = ChartFactory.createBarChart("Order Statistics", "Hospital", "Value", 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:userInterface.cdcRole.OverviewJPanel.java
private static JFreeChart createChart1(CategoryDataset categorydataset) { JFreeChart jfreechart = ChartFactory.createBarChart("Distribution of Vaccines", "Vaccine", "Quantity", categorydataset, PlotOrientation.VERTICAL, true, true, false); CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot(); categoryplot.setDomainGridlinesVisible(true); categoryplot.setRangeCrosshairVisible(true); categoryplot.setRangeCrosshairPaint(Color.green); 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.green, 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:userinterface.patientRole.LineChart.java
public LineChart(String applicationTitle, String chartTitle, XYSeries bR, XYSeries pR, XYSeries bS, XYSeries bP, JFrame parent) {//from w w w . j av a 2 s.c o m // super(applicationTitle); this.bR = bR; this.pR = pR; this.bS = bS; this.bP = bP; this.parent = parent; dataset = createDataset(); JFreeChart xylineChart = ChartFactory.createXYLineChart(chartTitle, "Category", "Vital Signs", createDataset(), PlotOrientation.VERTICAL, true, true, false); ChartPanel chartPanel = new ChartPanel(xylineChart); chartPanel.setPreferredSize(new java.awt.Dimension(560, 367)); final XYPlot plot = xylineChart.getXYPlot(); plot.setBackgroundPaint(Color.white); 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); setContentPane(chartPanel); addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent evt) { formWindowClosing(evt); } }); }
From source file:cs.register.geraGrafico.java
public geraGrafico(String title, int type, List<partida> L) { super(title); JFreeChart chart = null;//from w w w .j av a2s .co m switch (type) { case 0: chart = ChartFactory.createXYLineChart(title, "X", "y", datakill(L), PlotOrientation.VERTICAL, true, true, false); case 1: chart = ChartFactory.createXYLineChart(title, "X", "y", datakda(L), PlotOrientation.VERTICAL, true, true, false); case 2: chart = ChartFactory.createXYLineChart(title, "X", "y", datawld(L), PlotOrientation.VERTICAL, true, true, false); case 3: chart = ChartFactory.createXYLineChart(title, "X", "y", datasocore(L), PlotOrientation.VERTICAL, true, true, false); case 4: chart = ChartFactory.createXYLineChart(title, "X", "y", datarank(L), PlotOrientation.VERTICAL, true, true, false); } graf = new ChartPanel(chart); graf.setPreferredSize(new java.awt.Dimension(560, 367)); XYPlot plot = chart.getXYPlot(); XYLineAndShapeRenderer rendrer = new XYLineAndShapeRenderer(); rendrer.setSeriesPaint(0, Color.GREEN); rendrer.setSeriesStroke(0, new BasicStroke(4.0f)); plot.setRenderer(rendrer); setContentPane(graf); }
From source file:sturesy.voting.gui.renderer.AnswersBarRenderer.java
@Override public Paint getItemPaint(final int row, final int column) { if (_showAnswers && !_correctAnswer.isEmpty()) { if (_correctAnswer.contains(column)) { return Color.green; } else {/*from w w w. j a v a2 s . c o m*/ return Color.red; } } else { return Color.orange; } }
From source file:org.jfree.chart.demo.CylinderChartDemo1.java
private static Paint[] createPaint() { Paint apaint[] = new Paint[5]; apaint[0] = new GradientPaint(0.0F, 0.0F, Color.red, 0.0F, 0.0F, Color.white); apaint[1] = new GradientPaint(0.0F, 0.0F, Color.green, 0.0F, 0.0F, Color.white); apaint[2] = new GradientPaint(0.0F, 0.0F, Color.blue, 0.0F, 0.0F, Color.white); apaint[3] = new GradientPaint(0.0F, 0.0F, Color.orange, 0.0F, 0.0F, Color.white); apaint[4] = new GradientPaint(0.0F, 0.0F, Color.magenta, 0.0F, 0.0F, Color.white); return apaint; }
From source file:ImageProcessing.RGBHistogram_GUI.java
public RGBHistogram_GUI(Component callerComponent) { //callerComponent is used only to determine the position of this //frame when called. initComponents();/*from w w w. j a va 2s . co m*/ this.setLocationRelativeTo(callerComponent); //Determine the chart width & height for displaying. int chartLabelHeight = sourceImageGreenHistogram.getHeight(); int chartLabelWidth = sourceImageGreenHistogram.getWidth(); //Get values for each color component from source image. double[] sourceRedValues = ImageProcessing.extractRedColor(Main.getSourceImage()); double[] sourceGreenValues = ImageProcessing.extractGreenColor(Main.getSourceImage()); double[] sourceBlueValues = ImageProcessing.extractBlueColor(Main.getSourceImage()); //Get values for each color component from processed image. double[] processedRedValues = ImageProcessing.extractRedColor(Main.getProcessedImage()); double[] processedGreenValues = ImageProcessing.extractGreenColor(Main.getProcessedImage()); double[] processedBlueValues = ImageProcessing.extractBlueColor(Main.getProcessedImage()); //Create charts for each color component from source image. JFreeChart sourceRedChart = ImageProcessing.createHistogram(sourceRedValues, Color.RED); JFreeChart sourceGreenChart = ImageProcessing.createHistogram(sourceGreenValues, Color.GREEN); JFreeChart sourceBlueChart = ImageProcessing.createHistogram(sourceBlueValues, Color.BLUE); //Create charts for each color component from processed image. JFreeChart processedRedChart = ImageProcessing.createHistogram(processedRedValues, Color.RED); JFreeChart processedGreenChart = ImageProcessing.createHistogram(processedGreenValues, Color.GREEN); JFreeChart processedBlueChart = ImageProcessing.createHistogram(processedBlueValues, Color.BLUE); //Convert each source image charts to a BufferedImage. BufferedImage sourceRedChartImage = sourceRedChart.createBufferedImage(chartLabelWidth, chartLabelHeight); BufferedImage sourceGreenChartImage = sourceGreenChart.createBufferedImage(chartLabelWidth, chartLabelHeight); BufferedImage sourceBlueChartImage = sourceBlueChart.createBufferedImage(chartLabelWidth, chartLabelHeight); //Convert each processsed image charts to a BufferedImage. BufferedImage processedRedChartImage = processedRedChart.createBufferedImage(chartLabelWidth, chartLabelHeight); BufferedImage processedGreenChartImage = processedGreenChart.createBufferedImage(chartLabelWidth, chartLabelHeight); BufferedImage processedBlueChartImage = processedBlueChart.createBufferedImage(chartLabelWidth, chartLabelHeight); //Display each source image charts to GUI. sourceImageRedHistogram.setIcon(new ImageIcon(sourceRedChartImage)); sourceImageGreenHistogram.setIcon(new ImageIcon(sourceGreenChartImage)); sourceImageBlueHistogram.setIcon(new ImageIcon(sourceBlueChartImage)); //Display each source image charts to GUI. processedImageRedHistogram.setIcon(new ImageIcon(processedRedChartImage)); processedImageGreenHistogram.setIcon(new ImageIcon(processedGreenChartImage)); processedImageBlueHistogram.setIcon(new ImageIcon(processedBlueChartImage)); }