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:dpfmanager.conformancechecker.tiff.reporting.PdfReport.java
PDFParams makeConformSection(int nerrors, int nwarnings, String key, PDFParams pdfParams0, int pos_x, int image_width, int font_size, PDFont font) throws Exception { PDFParams pdfParams = pdfParams0;/*from w w w . j av a 2 s.c o m*/ String imgPath = "images/pdf/check.png"; if (nerrors > 0) { imgPath = "images/pdf/error.png"; pdfParams = writeTitle(pdfParams, key, imgPath, Color.red, pos_x + image_width + 10, font, font_size, 7); } else { pdfParams = writeTitle(pdfParams, key, imgPath, Color.green, pos_x + image_width + 10, font, font_size, 7); } pdfParams.y -= 10; return pdfParams; }
From source file:org.fhaes.jsea.JSEABarChart.java
/** * Creates a demo chart./* ww w . j a v a 2 s. c o m*/ * * @return A chart. */ @SuppressWarnings("deprecation") public static JFreeChart createChart(String title, double[] meanByWindow, int lengthOfWindow, int yearsPriorOfEvent, int yearsAfterEvent, double[][] leftEndPointSim, double[][] rightEndPointSim, String outputFilePrefix, int alphaLevel, int segmentIndex) { JSEABarChart.meanByWindow = meanByWindow; JSEABarChart.lengthOfWindow = lengthOfWindow; JSEABarChart.yearsPriorOfEvent = yearsPriorOfEvent; JSEABarChart.leftEndPointSim = leftEndPointSim; JSEABarChart.rightEndPointSim = rightEndPointSim; JSEABarChart.alphaLevel = alphaLevel; CategoryPlot plot = new CategoryPlot(); plot.setDataset(0, createDataset()); plot.setOrientation(PlotOrientation.VERTICAL); CustomBarRenderer renderer = new CustomBarRenderer(createPaint(lengthOfWindow, Color.gray)); renderer.setBarPainter(new StandardBarPainter()); renderer.setDrawBarOutline(false); renderer.setOutlinePaint(Color.yellow); renderer.setOutlineStroke(new BasicStroke(1.1f, BasicStroke.JOIN_ROUND, BasicStroke.JOIN_BEVEL)); renderer.setGradientPaintTransformer( new StandardGradientPaintTransformer(GradientPaintTransformType.CENTER_HORIZONTAL)); plot.setRenderer(0, renderer); Color allcolors[] = { Color.red, Color.green, Color.blue }; System.out.println("here is the alphlevel " + alphaLevel); // for (int k = 0; k <= 5; k++) { // if (k <= 2) { // / plot.setDataset(k + 1, createEndDataset(k, true)); // plot.setRenderer(k + 1, createCategoryItemRenderer(allcolors[k], k)); // } else { // plot.setDataset(k + 1, createEndDataset(k - 3, false)); // plot.setRenderer(k + 1, createCategoryItemRenderer(allcolors[k - 3], k - 3)); // } // } // for (int k = 0; k <1; k++) { // if (k <= 2) { plot.setDataset(1, createEndDataset(alphaLevel, true)); plot.setRenderer(1, createCategoryItemRenderer(allcolors[alphaLevel], alphaLevel)); // } else { plot.setDataset(4, createEndDataset(alphaLevel, false)); plot.setRenderer(4, createCategoryItemRenderer(allcolors[alphaLevel], alphaLevel)); // } // } plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); // plot.setBackgroundPaint(Color.WHITE); plot.setDomainAxis(new CategoryAxis("LAG")); plot.addRangeMarker(new ValueMarker(0)); plot.setRangeAxis(new NumberAxis(outputFilePrefix)); plot.setRangeGridlinesVisible(true); JFreeChart chart = new JFreeChart(plot); chart.setTitle(title); chart.removeLegend(); chart.setBackgroundPaint(Color.WHITE); return chart; }
From source file:info.mikaelsvensson.devtools.analysis.localaccesslog.LocalAccessLogReportGenerator.java
@Override public void generateReport(File outputFile, ReportPrinter reportPrinter) throws FileNotFoundException { final PrintStream ps = new PrintStream(outputFile); final Collection<LocalAccessLogSample> allSamples = _log.getSamples(); Map<String, Collection<LocalAccessLogSample>> samplesByTestSession = SampleCollector.COLLECTOR_BY_SESSION_DATE .getFilteredAndGrouped(allSamples); for (Map.Entry<String, Collection<LocalAccessLogSample>> sessionEntry : samplesByTestSession.entrySet()) { final Collection<LocalAccessLogSample> sessionSamples = sessionEntry.getValue(); Map<String, Collection<LocalAccessLogSample>> samples = SAMPLE_COLLECTOR .getFilteredAndGrouped(sessionSamples); String[][] data = new String[samples.size() + 1][]; int i = 0; int sumCount = 0; final DefaultPieDataset dataset = new DefaultPieDataset(); final JFreeChart chart = ChartFactory.createPieChart( "Status Codes For Session " + sessionEntry.getKey(), dataset, true, false, Locale.ENGLISH); final File chartFile = new File(outputFile.getAbsolutePath() + "." + StringUtils.remove(sessionEntry.getKey(), ':').replace(' ', '-') + ".png"); final PiePlot plot = (PiePlot) chart.getPlot(); for (Map.Entry<String, Collection<LocalAccessLogSample>> entry : samples.entrySet()) { final Collection<LocalAccessLogSample> responseCodeSamples = entry.getValue(); final int count = responseCodeSamples.size(); data[i++] = new String[] { entry.getKey(), ToStringUtil.toString(count), ToStringUtil.toString(_log.calculateAverage(responseCodeSamples)), ToStringUtil.toString(_log.calculateMin(responseCodeSamples)), ToStringUtil.toString(_log.calculateMax(responseCodeSamples)) }; sumCount += count;/* w w w . ja v a 2s . c om*/ final String label = entry.getKey() + " (" + count + " reqs)"; dataset.setValue(label, count); plot.setSectionPaint(label, entry.getKey().equals("200") ? Color.GREEN : Color.RED); } data[i] = new String[] { "All", ToStringUtil.toString(sumCount), ToStringUtil.toString(_log.calculateAverage(sessionSamples)), ToStringUtil.toString(_log.calculateMin(sessionSamples)), ToStringUtil.toString(_log.calculateMax(sessionSamples)) }; reportPrinter.printTable(ps, sessionEntry.getKey(), 10, new String[] { "Status Code", "# Requests", "Avg [ms]", "Min [ms]", "Max [ms]" }, data, null); if (sumCount > NUMBER_OF_REQUESTS_IN_SHORT_TEST) { try { ChartUtilities.saveChartAsPNG(chartFile, chart, 500, 500); } catch (IOException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } } } ps.close(); }
From source file:com.eviware.soapui.support.log.JLogList.java
public JLogList(String title) { super(new BorderLayout()); this.title = title; model = new LogListModel(); logList = new JList(model); logList.setToolTipText(title);//from w ww .ja va 2 s.c o m logList.setCellRenderer(new LogAreaCellRenderer()); logList.setPrototypeCellValue("Testing 123"); logList.setFixedCellWidth(-1); JPopupMenu listPopup = new JPopupMenu(); listPopup.add(new ClearAction()); enableAction = new EnableAction(); enableMenuItem = new JCheckBoxMenuItem(enableAction); enableMenuItem.setSelected(true); listPopup.add(enableMenuItem); listPopup.addSeparator(); listPopup.add(new CopyAction()); listPopup.add(new SetMaxRowsAction()); listPopup.addSeparator(); listPopup.add(new ExportToFileAction()); logList.setComponentPopupMenu(listPopup); setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3)); JScrollPane scrollPane = new JScrollPane(logList); UISupport.addPreviewCorner(scrollPane, true); add(scrollPane, BorderLayout.CENTER); requestAttributes = new SimpleAttributeSet(); StyleConstants.setForeground(requestAttributes, Color.BLUE); responseAttributes = new SimpleAttributeSet(); StyleConstants.setForeground(responseAttributes, Color.GREEN); try { maxRows = Long.parseLong(SoapUI.getSettings().getString("JLogList#" + title, "1000")); } catch (NumberFormatException e) { } }
From source file:FontAlgo.java
private static TextualChar getTextualChar(char a_char) throws Throwable { BufferedImage bImg = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_RGB); Graphics g = bImg.getGraphics(); g.setColor(Color.green); g.fillRect(0, 0, WIDTH, HEIGHT);/*w w w .ja va2 s . c o m*/ g.setFont(appliedFont); g.setColor(Color.black); g.drawString(new String(new char[] { a_char }), 10, g.getFontMetrics().getHeight()); PixelGrabber p = new PixelGrabber(bImg, 0, 0, WIDTH, HEIGHT, true); if (p.grabPixels()) { char[][] pattern = new char[WIDTH][HEIGHT]; int baseColourPixel = 0, contrastColourPixel = 0, x1 = 0, x2 = 0, y1 = 0, y2 = 0; int[] pixels = (int[]) p.getPixels(); baseColourPixel = pixels[0]; // System.out.println("base: " + base); int xCounter = 0, yCounter = 0; for (int iPixel : pixels) { // System.out.println(iX + " - " + iY); if (isReverse) { pattern[xCounter][yCounter] = iPixel == baseColourPixel ? CHAR_TO_PATTERN : ' '; } else { pattern[xCounter][yCounter] = iPixel != baseColourPixel ? CHAR_TO_PATTERN : ' '; } yCounter++; if (yCounter > 49) { xCounter++; yCounter = 0; } if (contrastColourPixel == 0 && iPixel != baseColourPixel) { contrastColourPixel = iPixel; x1 = xCounter - 2; y1 = yCounter - 3; y2 = yCounter + 3; } if (contrastColourPixel == iPixel) { x2 = xCounter + 3; if (y1 > (yCounter - 3)) { y1 = yCounter - 3; } if (y2 < (yCounter + 3)) { y2 = yCounter + 3; } } } return new TextualChar(x1, x2, y1, y2, pattern); } return null; }
From source file:chart.XYChart.java
public XYChart(String applicationTitle, String chartTitle, double[] xData, double[] YDataAnalitic, double[] YDataNumerical) { super(applicationTitle); JFreeChart xylineChart = ChartFactory.createXYLineChart(chartTitle, "", "", createDataset(xData, YDataAnalitic, YDataNumerical), PlotOrientation.VERTICAL, true, true, false); System.out.println("vvvv"); 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.setSeriesStroke(0, new BasicStroke(2.0f)); renderer.setSeriesStroke(1, new BasicStroke(2.0f)); plot.setRenderer(renderer);/*from w w w .j ava 2 s . co m*/ setContentPane(chartPanel); // panel.removeAll(); // panel.add(chartPanel); // panel.validate(); }
From source file:com.seleniumtests.it.driver.TestBrowserSnapshot.java
/** * Read the capture file to detect dimension * It assumes that picture background is white and counts the number of white pixels in width and height (first column and first row) * @return//from ww w. j a va 2s . c o m * @throws IOException */ private Dimension getViewPortDimension(File picture) throws IOException { BufferedImage image = ImageIO.read(picture); int width = 0; int height = 0; for (width = 0; width < image.getWidth(); width++) { Color color = new Color(image.getRGB(width, 0)); if (!(color.equals(Color.WHITE) || color.equals(Color.YELLOW) || color.equals(Color.ORANGE) || color.equals(Color.GREEN) || color.equals(Color.RED))) { break; } } for (height = 0; height < image.getHeight(); height++) { Color color = new Color(image.getRGB(5, height)); if (!(color.equals(Color.WHITE) || color.equals(Color.YELLOW) || color.equals(Color.ORANGE) || color.equals(Color.GREEN) || color.equals(Color.RED))) { break; } } return new Dimension(width, height); }
From source file:st.jigasoft.dbutil.util.ReportTheme.java
private static Color colorItems(int i) { ReportTheme.MAX_COLUNS_COLOR = 5;// ww w . j av a2s.com switch (i) { case 1: return Color.BLUE; case 2: return Color.RED; case 3: return Color.GREEN; default: return Color.YELLOW; } }
From source file:osh.comdriver.simulation.cruisecontrol.AbstractDrawer.java
/** * Creates a chart./* w w w .j a v a 2s .com*/ * * @param dataset1 a dataset. * * @return A chart. */ private JFreeChart createChart(XYDataset dataset, long lastentry) { JFreeChart chart = ChartFactory.createTimeSeriesChart(name, // title "time", // x-axis label "temperature", // y-axis label dataset, // data true, // create legend? true, // generate tooltips? false // generate URLs? ); chart.setBackgroundPaint(Color.white); XYPlot plot = (XYPlot) chart.getPlot(); NumberAxis axis1 = new NumberAxis(getAxisName()); axis1.setAutoRangeIncludesZero(isIncludeZero()); plot.setRangeAxis(0, axis1); plot.setDataset(0, dataset); plot.mapDatasetToRangeAxis(1, 0); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); //TODO: SHADOWS OFF final StandardXYItemRenderer r1 = new StandardXYItemRenderer(); plot.setRenderer(0, r1); r1.setSeriesPaint(0, Color.BLUE); r1.setSeriesPaint(1, Color.RED); r1.setSeriesPaint(2, Color.GREEN); //plot.setDomainAxis(new NumberAxis("time")); plot.setDomainAxis(new DateAxis()); plot.getDomainAxis().setAutoRange(false); long begin = getRangeBegin(lastentry); long end = getRangeEnd(lastentry); plot.getDomainAxis().setRange(begin, end); return chart; }
From source file:net.sf.jasperreports.chartthemes.simple.SimpleSettingsFactory.java
/** * *///from ww w . j a v a 2s . c o m public static final ChartThemeSettings createChartThemeSettings() { ChartThemeSettings settings = new ChartThemeSettings(); ChartSettings chartSettings = settings.getChartSettings(); chartSettings.setBackgroundPaint(new GradientPaintProvider(Color.green, Color.blue)); chartSettings.setBackgroundImage( new FileImageProvider("net/sf/jasperreports/chartthemes/simple/jasperreports.png")); chartSettings.setBackgroundImageAlignment(Align.TOP_RIGHT); chartSettings.setBackgroundImageAlpha(1f); chartSettings.setBorderVisible(Boolean.TRUE); chartSettings.setBorderPaint(new ColorProvider(Color.GREEN)); chartSettings.setBorderStroke(new BasicStroke(1f)); chartSettings.setAntiAlias(Boolean.TRUE); chartSettings.setTextAntiAlias(Boolean.TRUE); chartSettings.setPadding(new RectangleInsets(UnitType.ABSOLUTE, 1.1, 2.2, 3.3, 4.4)); TitleSettings titleSettings = settings.getTitleSettings(); titleSettings.setShowTitle(Boolean.TRUE); titleSettings.setPosition(EdgeEnum.TOP); titleSettings.setForegroundPaint(new ColorProvider(Color.black)); titleSettings.setBackgroundPaint(new GradientPaintProvider(Color.green, Color.blue)); titleSettings.getFont().setBold(Boolean.TRUE); titleSettings.getFont().setFontSize(22f); titleSettings.setHorizontalAlignment(HorizontalAlignment.CENTER); titleSettings.setVerticalAlignment(VerticalAlignment.TOP); titleSettings.setPadding(new RectangleInsets(UnitType.ABSOLUTE, 1.1, 2.2, 3.3, 4.4)); TitleSettings subtitleSettings = settings.getSubtitleSettings(); subtitleSettings.setShowTitle(Boolean.TRUE); subtitleSettings.setPosition(EdgeEnum.TOP); subtitleSettings.setForegroundPaint(new ColorProvider(Color.red)); subtitleSettings.setBackgroundPaint(new GradientPaintProvider(Color.green, Color.blue)); subtitleSettings.getFont().setBold(Boolean.TRUE); subtitleSettings.setHorizontalAlignment(HorizontalAlignment.LEFT); subtitleSettings.setVerticalAlignment(VerticalAlignment.CENTER); subtitleSettings.setPadding(new RectangleInsets(UnitType.ABSOLUTE, 1.1, 2.2, 3.3, 4.4)); LegendSettings legendSettings = settings.getLegendSettings(); legendSettings.setShowLegend(Boolean.TRUE); legendSettings.setPosition(EdgeEnum.BOTTOM); legendSettings.setForegroundPaint(new ColorProvider(Color.black)); legendSettings.setBackgroundPaint(new GradientPaintProvider(Color.green, Color.blue)); legendSettings.getFont().setBold(Boolean.TRUE); legendSettings.setHorizontalAlignment(HorizontalAlignment.CENTER); legendSettings.setVerticalAlignment(VerticalAlignment.BOTTOM); //FIXMETHEME legendSettings.setBlockFrame(); legendSettings.setPadding(new RectangleInsets(UnitType.ABSOLUTE, 1.1, 2.2, 3.3, 4.4)); PlotSettings plotSettings = settings.getPlotSettings(); plotSettings.setOrientation(PlotOrientation.VERTICAL); // plotSettings.setForegroundAlpha(0.5f); plotSettings.setBackgroundPaint(new GradientPaintProvider(Color.green, Color.blue)); // plotSettings.setBackgroundAlpha(0.5f); plotSettings.setBackgroundImage( new FileImageProvider("net/sf/jasperreports/chartthemes/simple/jasperreports.png")); plotSettings.setBackgroundImageAlpha(0.5f); plotSettings.setBackgroundImageAlignment(Align.NORTH_WEST); plotSettings.setLabelRotation(0d); plotSettings.setPadding(new RectangleInsets(UnitType.ABSOLUTE, 1.1, 2.2, 3.3, 4.4)); plotSettings.setOutlineVisible(Boolean.TRUE); plotSettings.setOutlinePaint(new ColorProvider(Color.red)); plotSettings.setOutlineStroke(new BasicStroke(1f)); plotSettings.setSeriesColorSequence(COLORS); // plotSettings.setSeriesGradientPaintSequence(GRADIENT_PAINTS); plotSettings.setSeriesOutlinePaintSequence(COLORS_DARKER); plotSettings.setSeriesStrokeSequence(STROKES); plotSettings.setSeriesOutlineStrokeSequence(OUTLINE_STROKES); plotSettings.setDomainGridlineVisible(Boolean.TRUE); plotSettings.setDomainGridlinePaint(new ColorProvider(Color.DARK_GRAY)); plotSettings.setDomainGridlineStroke(new BasicStroke(0.5f)); plotSettings.setRangeGridlineVisible(Boolean.TRUE); plotSettings.setRangeGridlinePaint(new ColorProvider(Color.BLACK)); plotSettings.setRangeGridlineStroke(new BasicStroke(0.5f)); plotSettings.getTickLabelFont().setFontName("Courier"); plotSettings.getTickLabelFont().setBold(Boolean.TRUE); plotSettings.getTickLabelFont().setFontSize(10f); plotSettings.getDisplayFont().setFontName("Arial"); plotSettings.getDisplayFont().setBold(Boolean.TRUE); plotSettings.getDisplayFont().setFontSize(12f); AxisSettings domainAxisSettings = settings.getDomainAxisSettings(); domainAxisSettings.setVisible(Boolean.TRUE); domainAxisSettings.setLocation(AxisLocation.BOTTOM_OR_RIGHT); domainAxisSettings.setLinePaint(new ColorProvider(Color.green)); domainAxisSettings.setLineStroke(new BasicStroke(1f)); domainAxisSettings.setLineVisible(Boolean.TRUE); // domainAxisSettings.setLabel("Domain Axis"); domainAxisSettings.setLabelAngle(0.0d); domainAxisSettings.setLabelPaint(new ColorProvider(Color.magenta)); domainAxisSettings.getLabelFont().setBold(Boolean.TRUE); domainAxisSettings.getLabelFont().setItalic(Boolean.TRUE); domainAxisSettings.getLabelFont().setFontName("Comic Sans MS"); domainAxisSettings.getLabelFont().setFontSize(12f); domainAxisSettings.setLabelInsets(new RectangleInsets(UnitType.ABSOLUTE, 0.5, 0.5, 1, 1)); domainAxisSettings.setLabelVisible(Boolean.TRUE); domainAxisSettings.setTickLabelPaint(new ColorProvider(Color.cyan)); domainAxisSettings.getTickLabelFont().setBold(Boolean.TRUE); domainAxisSettings.getTickLabelFont().setItalic(Boolean.FALSE); domainAxisSettings.getTickLabelFont().setFontName("Arial"); domainAxisSettings.getTickLabelFont().setFontSize(10f); domainAxisSettings.setTickLabelInsets(new RectangleInsets(UnitType.ABSOLUTE, 0.5, 0.5, 0.5, 0.5)); domainAxisSettings.setTickLabelsVisible(Boolean.TRUE); domainAxisSettings.setTickMarksInsideLength(0.1f); domainAxisSettings.setTickMarksOutsideLength(0.2f); domainAxisSettings.setTickMarksPaint(new ColorProvider(Color.ORANGE)); domainAxisSettings.setTickMarksStroke(new BasicStroke(1f)); domainAxisSettings.setTickMarksVisible(Boolean.TRUE); domainAxisSettings.setTickCount(5); AxisSettings rangeAxisSettings = settings.getRangeAxisSettings(); rangeAxisSettings.setVisible(Boolean.TRUE); rangeAxisSettings.setLocation(AxisLocation.TOP_OR_RIGHT); rangeAxisSettings.setLinePaint(new ColorProvider(Color.yellow)); rangeAxisSettings.setLineStroke(new BasicStroke(1f)); rangeAxisSettings.setLineVisible(Boolean.TRUE); // rangeAxisSettings.setLabel("Range Axis"); rangeAxisSettings.setLabelAngle(Math.PI / 2.0d); rangeAxisSettings.setLabelPaint(new ColorProvider(Color.green)); rangeAxisSettings.getLabelFont().setBold(Boolean.TRUE); rangeAxisSettings.getLabelFont().setItalic(Boolean.TRUE); rangeAxisSettings.getLabelFont().setFontName("Comic Sans MS"); rangeAxisSettings.getLabelFont().setFontSize(12f); rangeAxisSettings.setLabelInsets(new RectangleInsets(UnitType.ABSOLUTE, 0.5, 0.5, 1, 1)); rangeAxisSettings.setLabelVisible(Boolean.TRUE); rangeAxisSettings.setTickLabelPaint(new ColorProvider(Color.pink)); rangeAxisSettings.getTickLabelFont().setBold(Boolean.FALSE); rangeAxisSettings.getTickLabelFont().setItalic(Boolean.TRUE); rangeAxisSettings.getTickLabelFont().setFontName("Arial"); rangeAxisSettings.getTickLabelFont().setFontSize(10f); rangeAxisSettings.setTickLabelInsets(new RectangleInsets(UnitType.ABSOLUTE, 0.5, 0.5, 0.5, 0.5)); rangeAxisSettings.setTickLabelsVisible(Boolean.TRUE); rangeAxisSettings.setTickMarksInsideLength(0.2f); rangeAxisSettings.setTickMarksOutsideLength(0.1f); rangeAxisSettings.setTickMarksPaint(new ColorProvider(Color.black)); rangeAxisSettings.setTickMarksStroke(new BasicStroke(1f)); rangeAxisSettings.setTickMarksVisible(Boolean.TRUE); rangeAxisSettings.setTickCount(6); return settings; }