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:cl.apr.pdf.chart.BarChartAviso.java
public CustomRenderer() { this.colors = new Paint[] { Color.red, Color.blue, Color.green, Color.yellow, Color.orange, Color.cyan, Color.magenta, Color.blue }; }
From source file:org.jfree.chart.demo.MarkerDemo1.java
/** * Creates a sample chart./* w w w.j a v a 2 s .co m*/ * * @param data the sample data. * * @return A configured chart. */ private JFreeChart createChart(final XYDataset data) { final JFreeChart chart = ChartFactory.createScatterPlot("Marker Demo 1", "X", "Y", data, PlotOrientation.VERTICAL, true, true, false); // chart.getLegend().setAnchor(Legend.EAST); // customise... final XYPlot plot = chart.getXYPlot(); plot.getRenderer().setToolTipGenerator(StandardXYToolTipGenerator.getTimeSeriesInstance()); // set axis margins to allow space for marker labels... final DateAxis domainAxis = new DateAxis("Time"); domainAxis.setUpperMargin(0.50); plot.setDomainAxis(domainAxis); final ValueAxis rangeAxis = plot.getRangeAxis(); rangeAxis.setUpperMargin(0.30); rangeAxis.setLowerMargin(0.50); // add a labelled marker for the bid start price... final Marker start = new ValueMarker(200.0); start.setPaint(Color.green); start.setLabel("Bid Start Price"); start.setLabelAnchor(RectangleAnchor.BOTTOM_RIGHT); start.setLabelTextAnchor(TextAnchor.TOP_RIGHT); plot.addRangeMarker(start); // add a labelled marker for the target price... final Marker target = new ValueMarker(175.0); target.setPaint(Color.red); target.setLabel("Target Price"); target.setLabelAnchor(RectangleAnchor.TOP_RIGHT); target.setLabelTextAnchor(TextAnchor.BOTTOM_RIGHT); plot.addRangeMarker(target); // add a labelled marker for the original closing time... final Hour hour = new Hour(2, new Day(22, 5, 2003)); double millis = hour.getFirstMillisecond(); final Marker originalEnd = new ValueMarker(millis); originalEnd.setPaint(Color.orange); originalEnd.setLabel("Original Close (02:00)"); originalEnd.setLabelAnchor(RectangleAnchor.TOP_LEFT); originalEnd.setLabelTextAnchor(TextAnchor.TOP_RIGHT); plot.addDomainMarker(originalEnd); // add a labelled marker for the current closing time... final Minute min = new Minute(15, hour); millis = min.getFirstMillisecond(); final Marker currentEnd = new ValueMarker(millis); currentEnd.setPaint(Color.red); currentEnd.setLabel("Close Date (02:15)"); currentEnd.setLabelAnchor(RectangleAnchor.TOP_RIGHT); currentEnd.setLabelTextAnchor(TextAnchor.TOP_LEFT); plot.addDomainMarker(currentEnd); // **************************************************************************** // * JFREECHART DEVELOPER GUIDE * // * The JFreeChart Developer Guide, written by David Gilbert, is available * // * to purchase from Object Refinery Limited: * // * * // * http://www.object-refinery.com/jfreechart/guide.html * // * * // * Sales are used to provide funding for the JFreeChart project - please * // * support us so that we can continue developing free software. * // **************************************************************************** // label the best bid with an arrow and label... final Hour h = new Hour(2, new Day(22, 5, 2003)); final Minute m = new Minute(10, h); millis = m.getFirstMillisecond(); final CircleDrawer cd = new CircleDrawer(Color.red, new BasicStroke(1.0f), null); final XYAnnotation bestBid = new XYDrawableAnnotation(millis, 163.0, 11, 11, cd); plot.addAnnotation(bestBid); final XYPointerAnnotation pointer = new XYPointerAnnotation("Best Bid", millis, 163.0, 3.0 * Math.PI / 4.0); pointer.setBaseRadius(35.0); pointer.setTipRadius(10.0); pointer.setFont(new Font("SansSerif", Font.PLAIN, 9)); pointer.setPaint(Color.blue); pointer.setTextAnchor(TextAnchor.HALF_ASCENT_RIGHT); plot.addAnnotation(pointer); return chart; }
From source file:be.ac.ua.comp.scarletnebula.gui.ServerCellRenderer.java
private ChartPanel createAndStoreBareChartPanel(final JList list, final Server server) { final BareGraph graph = new BareGraph((long) 10 * 60 * 1000); graph.registerRelativeDatastream(server, server.getPreferredDatastream(), Color.GREEN); graph.addServerToRefresh(server);//from w ww . ja va2 s .co m final ChartPanel chartPanel = graph.getChartPanel(); log.info("Making new baregraph for server " + server); server.getServerStatistics().addNoStatisticsListener(new NoStatisticsListener() { @Override public void connectionFailed(ServerStatisticsManager manager) { GraphPanelCache.get().clearBareServerCache(server); } }); GraphPanelCache.get().addToBareServerCache(server, chartPanel); return chartPanel; }
From source file:com.orange.atk.atkUI.coregui.StatisticTool.java
/** * Creates the chart.//from ww w .j av a2 s . com * * @param piedataset * the data set * @return the created chart */ private JFreeChart createChart(PieDataset piedataset) { JFreeChart jfreechart = ChartFactory.createPieChart3D("", piedataset, true, true, false); jfreechart.setBackgroundPaint(Color.lightGray); PiePlot pie3dplot = (PiePlot) jfreechart.getPlot(); pie3dplot.setStartAngle(0); pie3dplot.setDirection(Rotation.CLOCKWISE); pie3dplot.setForegroundAlpha(0.5F); pie3dplot.setNoDataMessage("No data to display"); pie3dplot.setSectionPaint(0, Color.GREEN);// passed pie3dplot.setSectionPaint(1, Color.RED);// failed pie3dplot.setSectionPaint(2, Color.ORANGE);// skipped pie3dplot.setSectionPaint(3, Color.LIGHT_GRAY);// not analysed pie3dplot.setToolTipGenerator(new MyToolTipGenerator()); pie3dplot.setLabelGenerator(new MySectionLabelGenerator()); pie3dplot.setLegendLabelGenerator(new MySectionLabelGenerator()); return jfreechart; }
From source file:umontreal.ssj.charts.SSJCategorySeriesCollection.java
/** * Converts a java Color object into a friendly and readable LaTeX/xcolor string. * * @param color in color./*from w w w . jav a2s . c o m*/ * @return friendly color with string format as possible, null otherwise. */ protected static String detectXColorClassic(Color color) { String retour = null; int red = color.getRed(); int green = color.getGreen(); int blue = color.getBlue(); // On utilise pas la method Color.equals(Color ) car on ne veut pas tester le parametre de transparence : Alpha if (red == Color.GREEN.getRed() && blue == Color.GREEN.getBlue() && green == Color.GREEN.getGreen()) return "green"; else if (red == Color.RED.getRed() && blue == Color.RED.getBlue() && green == Color.RED.getGreen()) return "red"; else if (red == Color.WHITE.getRed() && blue == Color.WHITE.getBlue() && green == Color.WHITE.getGreen()) return "white"; else if (red == Color.GRAY.getRed() && blue == Color.GRAY.getBlue() && green == Color.GRAY.getGreen()) return "gray"; else if (red == Color.BLACK.getRed() && blue == Color.BLACK.getBlue() && green == Color.BLACK.getGreen()) return "black"; else if (red == Color.YELLOW.getRed() && blue == Color.YELLOW.getBlue() && green == Color.YELLOW.getGreen()) return "yellow"; else if (red == Color.MAGENTA.getRed() && blue == Color.MAGENTA.getBlue() && green == Color.MAGENTA.getGreen()) return "magenta"; else if (red == Color.CYAN.getRed() && blue == Color.CYAN.getBlue() && green == Color.CYAN.getGreen()) return "cyan"; else if (red == Color.BLUE.getRed() && blue == Color.BLUE.getBlue() && green == Color.BLUE.getGreen()) return "blue"; else if (red == Color.DARK_GRAY.getRed() && blue == Color.DARK_GRAY.getBlue() && green == Color.DARK_GRAY.getGreen()) return "darkgray"; else if (red == Color.LIGHT_GRAY.getRed() && blue == Color.LIGHT_GRAY.getBlue() && green == Color.LIGHT_GRAY.getGreen()) return "lightgray"; else if (red == Color.ORANGE.getRed() && blue == Color.ORANGE.getBlue() && green == Color.ORANGE.getGreen()) return "orange"; else if (red == Color.PINK.getRed() && blue == Color.PINK.getBlue() && green == Color.PINK.getGreen()) return "pink"; if (red == 192 && blue == 128 && green == 64) return "brown"; else if (red == 128 && blue == 128 && green == 0) return "olive"; else if (red == 128 && blue == 0 && green == 128) return "violet"; else if (red == 192 && blue == 0 && green == 64) return "purple"; else return null; }
From source file:graphs.LimitsGraphs.java
/** * Creates a sample chart.// ww w . ja va2 s . c o m * * @param dataset the dataset. * * @return The chart. */ private JFreeChart createChart(final CategoryDataset dataset) { // create the chart... final JFreeChart chart = ChartFactory.createBarChart("Limits ..", // chart title "Metric", // 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... 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; }
From source file:RMOS.PieChart.java
/** * Creates a chart./*from w ww. ja v a2s .c om*/ * * @param dataset the dataset. * * @return A chart. */ private static JFreeChart createChart(PieDataset dataset) { JFreeChart chart = ChartFactory.createPieChart("Eco Systems Statistics", // chart title dataset, // data false, // no legend true, // tooltips false // no URL generation ); // set a custom background for the chart chart.setBackgroundPaint( new GradientPaint(new Point(0, 0), new Color(20, 20, 20), new Point(400, 200), Color.DARK_GRAY)); // customise the title position and font TextTitle t = chart.getTitle(); t.setHorizontalAlignment(HorizontalAlignment.LEFT); t.setPaint(new Color(240, 240, 240)); t.setFont(new Font("Arial", Font.BOLD, 26)); PiePlot plot = (PiePlot) chart.getPlot(); plot.setBackgroundPaint(null); plot.setInteriorGap(0.04); plot.setOutlineVisible(false); plot.setSectionPaint(f1.getStationInGroup().get(1), Color.blue); plot.setSectionPaint(f1.getStationInGroup().get(1), Color.GREEN); // use gradients and white borders for the section colours /*plot.setSectionPaint("Others", createGradientPaint(new Color(200, 200, 255), Color.BLUE)); plot.setSectionPaint("Samsung", createGradientPaint(new Color(255, 200, 200), Color.RED)); plot.setSectionPaint("Apple", createGradientPaint(new Color(200, 255, 200), Color.GREEN)); plot.setSectionPaint("Nokia", createGradientPaint(new Color(200, 255, 200), Color.YELLOW));*/ plot.setBaseSectionOutlinePaint(Color.WHITE); plot.setSectionOutlinesVisible(true); plot.setBaseSectionOutlineStroke(new BasicStroke(2.0f)); // customise the section label appearance plot.setLabelFont(new Font("Courier New", Font.BOLD, 20)); plot.setLabelLinkPaint(Color.WHITE); plot.setLabelLinkStroke(new BasicStroke(2.0f)); plot.setLabelOutlineStroke(null); plot.setLabelPaint(Color.WHITE); plot.setLabelBackgroundPaint(null); // add a subtitle giving the data source TextTitle source = new TextTitle("Source: Eco Recycle Station", new Font("Courier New", Font.PLAIN, 12)); source.setPaint(Color.WHITE); source.setPosition(RectangleEdge.BOTTOM); source.setHorizontalAlignment(HorizontalAlignment.RIGHT); chart.addSubtitle(source); return chart; }
From source file:com.opensourcestrategies.financials.reports.JFreeFinancialCharts.java
/** * Liquidity snapshot chart. Documentation is at http://www.opentaps.org/docs/index.php/Financials_Home_Screen * * Because a user might not have permission to view balances in all areas, this method takes into consideration * the ability to view various bars in the chart. * * @param accountsMap Map of accounts keyed by the glAccountType * @return String filename pointing to the chart, to be used with showChart URI request *//*from w w w .j a v a 2s.c o m*/ public static String createLiquiditySnapshotChart(Map<String, GenericValue> accountsMap, List<GenericValue> creditCardAccounts, Locale locale, boolean hasReceivablesPermission, boolean hasPayablesPermission, boolean hasInventoryPermission) throws GenericEntityException, IOException { Map<String, Object> uiLabelMap = UtilMessage.getUiLabels(locale); // create the dataset DefaultCategoryDataset dataset = new DefaultCategoryDataset(); // compile the four bars if (hasReceivablesPermission) { double cashBalance = 0.0; cashBalance += getPostedBalance(accountsMap.get("UNDEPOSITED_RECEIPTS")); cashBalance += getPostedBalance(accountsMap.get("BANK_STLMNT_ACCOUNT")); dataset.addValue(cashBalance, "", (String) uiLabelMap.get("FinancialsCashEquivalents")); double receivablesBalance = 0.0; receivablesBalance += getPostedBalance(accountsMap.get("ACCOUNTS_RECEIVABLE")); // merchant account settlement balances are receivable receivablesBalance += getPostedBalance(accountsMap.get("MRCH_STLMNT_ACCOUNT")); dataset.addValue(receivablesBalance, "", (String) uiLabelMap.get("FinancialsReceivables")); } if (hasInventoryPermission) { double inventoryBalance = 0.0; inventoryBalance += getPostedBalance(accountsMap.get("INVENTORY_ACCOUNT")); inventoryBalance += getPostedBalance(accountsMap.get("RAWMAT_INVENTORY")); inventoryBalance += getPostedBalance(accountsMap.get("WIP_INVENTORY")); dataset.addValue(inventoryBalance, "", (String) uiLabelMap.get("WarehouseInventory")); } if (hasPayablesPermission) { double payablesBalance = 0.0; payablesBalance += getPostedBalance(accountsMap.get("ACCOUNTS_PAYABLE")); payablesBalance += getPostedBalance(accountsMap.get("COMMISSIONS_PAYABLE")); payablesBalance += getPostedBalance(accountsMap.get("UNINVOICED_SHIP_RCPT")); dataset.addValue(payablesBalance, "", (String) uiLabelMap.get("FinancialsPayables")); } // set up the chart JFreeChart chart = ChartFactory.createBarChart((String) uiLabelMap.get("FinancialsLiquiditySnapshot"), // chart title null, // domain axis label null, // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation false, // include legend true, // tooltips false // urls ); chart.setBackgroundPaint(Color.white); chart.setBorderVisible(true); chart.setPadding(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); // get a reference to the plot for further customisation... final CategoryPlot plot = chart.getCategoryPlot(); plot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT); // get the bar renderer to put effects on the bars final BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setDrawBarOutline(false); // disable bar outlines // set up gradient paint on bar final GradientPaint gp = new GradientPaint(0.0f, 0.0f, Color.GREEN, 0.0f, 0.0f, Color.GRAY); renderer.setSeriesPaint(0, gp); // change the auto tick unit selection to integer units only... final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); // tilt the category labels so they fit CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 6.0)); // save as a png and return the file name return ServletUtilities.saveChartAsPNG(chart, 400, 300, null); }
From source file:org.jfree.chart.demo.selection.SelectionDemo5Category.java
private static JFreeChart createChart(CategoryDataset dataset, DatasetSelectionExtension<CategoryCursor<String, String>> ext) { // create the chart... JFreeChart chart = ChartFactory.createBarChart("Bar Chart Demo 1", "Category", "Value", dataset); CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.setDomainGridlinesVisible(true); plot.setRangeCrosshairVisible(true); plot.setRangeCrosshairPaint(Color.blue); // 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);//from ww w. ja v a2s. c om // 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); renderer.setLegendItemToolTipGenerator(new StandardCategorySeriesLabelGenerator("Tooltip: {0}")); CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 6.0)); //add selection specific rendering IRSUtilities.setSelectedItemPaint(renderer, ext, Color.WHITE); //register plot as selection change listener ext.addChangeListener(plot); return chart; }
From source file:MenuItemChooser.java
private void initGUI() { JPanel itemDetailsPanel = new JPanel(); itemDetailsPanel.setLayout(new GridLayout(4, 2)); itemDetailsPanel.setBackground(Color.WHITE); JLabel lbl = new JLabel("Item: "); itemDetailsPanel.add(lbl);/*w w w . j av a 2 s . com*/ itemName = new JLabel(""); itemDetailsPanel.add(itemName); lbl = new JLabel("Type: "); itemDetailsPanel.add(lbl); itemType = new JLabel(""); itemDetailsPanel.add(itemType); lbl = new JLabel("Price: $ "); itemDetailsPanel.add(lbl); price = new JLabel(""); itemDetailsPanel.add(price); lbl = new JLabel("Quantity: "); itemDetailsPanel.add(lbl); qty = new JTextField("0", 1); qty.addActionListener(this); qty.addFocusListener(this); itemDetailsPanel.add(qty); JPanel imgDescPanel = new JPanel(new BorderLayout()); imgDescPanel.setBackground(Color.WHITE); image = new JLabel(""); image.setHorizontalAlignment(SwingConstants.CENTER); image.setVerticalAlignment(SwingConstants.CENTER); imgDescPanel.add(image, BorderLayout.NORTH); desc = new JLabel("desc"); imgDescPanel.add(desc, BorderLayout.SOUTH); JPanel buttonPanel = new JPanel(); buttonPanel.setBackground(Color.WHITE); next = new JButton("Next"); next.addActionListener(this); buttonPanel.add(next); prev = new JButton("Previous"); prev.addActionListener(this); buttonPanel.add(prev); order = new JButton("Order"); order.addActionListener(this); buttonPanel.add(order); cancel = new JButton("Cancel / New"); cancel.addActionListener(this); buttonPanel.add(cancel); close = new JButton("Close"); close.addActionListener(this); close.setEnabled(false); buttonPanel.add(close); totalLbl = new JLabel(""); totalLbl.setFont(new Font("Serif", Font.BOLD, 14)); totalLbl.setForeground((Color.GREEN).darker()); buttonPanel.add(totalLbl); BorderLayout bl = new BorderLayout(); bl.setHgap(30); bl.setVgap(20); setLayout(bl); setBackground(Color.WHITE); add(itemDetailsPanel, BorderLayout.WEST); add(imgDescPanel, BorderLayout.EAST); add(buttonPanel, BorderLayout.SOUTH); TitledBorder title = BorderFactory.createTitledBorder("Choose Menu Items And Place Order"); setBorder(title); loadMenuItem(); }