List of usage examples for java.awt Color YELLOW
Color YELLOW
To view the source code for java.awt Color YELLOW.
Click Source Link
From source file:org.jfree.chart.demo.XMLBarChartDemo.java
/** * Default constructor./*www .ja v a 2 s. c om*/ * * @param title the frame title. */ public XMLBarChartDemo(final String title) { super(title); // create a dataset... CategoryDataset dataset = null; final URL url = getClass().getResource("/org/jfree/chart/demo/categorydata.xml"); try { final InputStream in = url.openStream(); dataset = DatasetReader.readCategoryDatasetFromXML(in); } catch (IOException ioe) { System.out.println(ioe.getMessage()); } // create the chart... final JFreeChart chart = ChartFactory.createBarChart("Bar Chart", // chart title "Domain", "Range", dataset, // data PlotOrientation.VERTICAL, true, // include legend true, false); // set the background color for the chart... chart.setBackgroundPaint(Color.yellow); // add the chart to a panel... final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(500, 270)); setContentPane(chartPanel); }
From source file:com.liveperson.infra.akka.actorx.ui.DisplayGraph.java
public static JPanel getGraphPanel() { final VisualizationViewer<String, String> vv = new VisualizationViewer<String, String>(new FRLayout(graph)); vv.setBackground(Color.white); vv.getRenderContext().setVertexFillPaintTransformer( new PickableVertexPaintTransformer<String>(vv.getPickedVertexState(), Color.blue, Color.yellow)); vv.getRenderContext().setVertexLabelTransformer(new Transformer<String, String>() { @Override// w w w . j ava 2 s . c o m public String transform(String s) { return getClassName(s); } }); vv.setVertexToolTipTransformer(new Transformer<String, String>() { @Override public String transform(String s) { return getClassName(s); } }); vv.getRenderContext().setEdgeDrawPaintTransformer( new PickableEdgePaintTransformer<String>(vv.getPickedEdgeState(), Color.black, Color.green)); vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.QuadCurve<String, String>()); vv.setEdgeToolTipTransformer(new Transformer<String, String>() { @Override public String transform(String edge) { StringBuffer buffer = new StringBuffer(); buffer.append("<html>"); int index = edge.indexOf(Main.DELIMITER); String fromActor = edge.substring(0, index); String toActor = edge.substring(index + Main.DELIMITER.length()); Map<String, Set<String>> connections = castConnectionList.get(fromActor); Set<String> messages = connections.get(toActor); for (String msg : messages) { buffer.append("<p>").append(getClassName(msg)); } buffer.append("</html>"); return buffer.toString(); } }); ToolTipManager.sharedInstance().setDismissDelay(60000); final DefaultModalGraphMouse<String, String> graphMouse = new DefaultModalGraphMouse<String, String>(); graphMouse.setMode(ModalGraphMouse.Mode.PICKING); vv.setGraphMouse(graphMouse); final ScalingControl scaler = new CrossoverScalingControl(); JButton plus = new JButton("+"); plus.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { scaler.scale(vv, 1.1f, vv.getCenter()); } }); JButton minus = new JButton("-"); minus.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { scaler.scale(vv, 1 / 1.1f, vv.getCenter()); } }); JButton reset = new JButton("reset"); reset.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Layout<String, String> layout = vv.getGraphLayout(); layout.initialize(); Relaxer relaxer = vv.getModel().getRelaxer(); if (relaxer != null) { // if(layout instanceof IterativeContext) { relaxer.stop(); relaxer.prerelax(); relaxer.relax(); } } }); JPanel jp = new JPanel(); jp.setBackground(Color.WHITE); jp.setLayout(new BorderLayout()); jp.add(vv, BorderLayout.CENTER); Class[] combos = getCombos(); final JComboBox jcb = new JComboBox(combos); // use a renderer to shorten the layout name presentation jcb.setRenderer(new DefaultListCellRenderer() { public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { String valueString = value.toString(); valueString = valueString.substring(valueString.lastIndexOf('.') + 1); return super.getListCellRendererComponent(list, valueString, index, isSelected, cellHasFocus); } }); jcb.addActionListener(new LayoutChooser(jcb, vv)); jcb.setSelectedItem(FRLayout.class); JPanel control_panel = new JPanel(new GridLayout(2, 1)); JPanel topControls = new JPanel(); JPanel bottomControls = new JPanel(); control_panel.add(topControls); control_panel.add(bottomControls); jp.add(control_panel, BorderLayout.NORTH); topControls.add(jcb); bottomControls.add(plus); bottomControls.add(minus); bottomControls.add(reset); return jp; }
From source file:org.jfree.chart.demo.XMLPieChartDemo.java
/** * Default constructor./* w w w . jav a 2 s . c om*/ * * @param title the frame title. */ public XMLPieChartDemo(final String title) { super(title); // create a dataset... PieDataset dataset = null; final URL url = getClass().getResource("/org/jfree/chart/demo/piedata.xml"); try { final InputStream in = url.openStream(); dataset = DatasetReader.readPieDatasetFromXML(in); } catch (IOException ioe) { System.out.println(ioe.getMessage()); } // create the chart... final JFreeChart chart = ChartFactory.createPieChart("Pie Chart Demo 1", // chart title dataset, // data true, // include legend true, false); // set the background color for the chart... chart.setBackgroundPaint(Color.yellow); final PiePlot plot = (PiePlot) chart.getPlot(); plot.setLabelGenerator(new StandardPieItemLabelGenerator("{0} = {2}", NumberFormat.getNumberInstance(), NumberFormat.getPercentInstance())); plot.setNoDataMessage("No data available"); // add the chart to a panel... final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(500, 270)); setContentPane(chartPanel); }
From source file:org.jfree.graphics2d.demo.SVGBarChartDemo1.java
/** * Creates a sample chart.//from w ww .ja v a2s .c o m * * @param dataset a dataset. * * @return The chart. */ private static JFreeChart createChart(CategoryDataset dataset) { JFreeChart chart = ChartFactory.createLineChart("Statistical Bar Chart Demo 1", "Type", "Value", dataset); CategoryPlot plot = (CategoryPlot) chart.getPlot(); // customise the range axis... NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); rangeAxis.setAutoRangeIncludesZero(false); // customise the renderer... StatisticalBarRenderer renderer = new StatisticalBarRenderer(); renderer.setDrawBarOutline(false); renderer.setErrorIndicatorPaint(Color.black); renderer.setIncludeBaseInRange(false); plot.setRenderer(renderer); // ensure the current theme is applied to the renderer just added ChartUtilities.applyCurrentTheme(chart); renderer.setDefaultItemLabelGenerator(new StandardCategoryItemLabelGenerator()); renderer.setDefaultItemLabelsVisible(true); renderer.setDefaultItemLabelPaint(Color.yellow); renderer.setDefaultPositiveItemLabelPosition( new ItemLabelPosition(ItemLabelAnchor.INSIDE6, TextAnchor.BOTTOM_CENTER)); // 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)); renderer.setSeriesPaint(0, gp0); renderer.setSeriesPaint(1, gp1); return chart; }
From source file:j2se.jfreechart.barchart.BarChartDemo6.java
/** * Creates a new demo./*from w w w.j ava2 s . co m*/ * * @param title the frame title. */ public BarChartDemo6(final String title) { super(title); // create a dataset... final DefaultCategoryDataset dataset = new DefaultCategoryDataset(); dataset.addValue(83.0, "First", "Factor 1"); // create the chart... final JFreeChart chart = ChartFactory.createBarChart(null, // chart title "Category", // domain axis label "Score (%)", // range axis label dataset, // data PlotOrientation.HORIZONTAL, false, // include legend true, false); // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... chart.setBackgroundPaint(Color.yellow); // not seen final CategoryPlot plot = chart.getCategoryPlot(); // plot.setInsets(new Insets(0, 0, 0, 0)); plot.setRangeGridlinesVisible(false); final CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setLowerMargin(0.20); domainAxis.setUpperMargin(0.20); domainAxis.setVisible(false); final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setRange(0.0, 100.0); rangeAxis.setVisible(false); // OPTIONAL CUSTOMISATION COMPLETED. // add the chart to a panel... final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(500, 270)); setContentPane(chartPanel); }
From source file:gov.nih.nci.cma.web.graphing.CMAPrincipalComponentAnalysisPlot.java
public CMAPrincipalComponentAnalysisPlot(Collection<CMAPCADataPoint> dataPoints, PCAcomponent component1, PCAcomponent component2, Map<String, String> sampleGroupNames) { //, ColorByType colorBy) { //this.colorBy = colorBy; this.component1 = component1; this.component2 = component2; this.dataPoints = dataPoints; this.nf.setMaximumFractionDigits(1); this.sampleGroupNames = sampleGroupNames; colorMap.put("1", Color.GREEN); colorMap.put("2", Color.BLUE); colorMap.put("3", Color.YELLOW); colorMap.put("4", Color.CYAN); colorMap.put("5", Color.MAGENTA); colorMap.put("6", Color.ORANGE); colorMap.put("7", Color.PINK); colorMap.put("8", Color.RED); colorMap.put("9", Color.GRAY); createChart();/* w w w . java2s . c o m*/ }
From source file:com.orsonpdf.demo.PDFPieChartDemo1.java
/** * Creates a chart.// w w w . ja v a 2 s. co m * * @param dataset the dataset. * * @return A chart. */ private static JFreeChart createChart(PieDataset dataset) { JFreeChart chart = ChartFactory.createPieChart("Smart Phones Manufactured / Q3 2011", dataset, false, false, false); 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.setShadowPaint(null); plot.setLabelShadowPaint(null); // 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); BasicStroke bs = new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER, 1.0f); 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: http://www.bbc.co.uk/news/business-15489523", 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:me.openMap.ApplicationSettings.java
/** * /*from w w w. j a v a2 s . co m*/ */ private ApplicationSettings() { gradParms.add(new GradientParameters(Color.decode("#A0A0FF"), Color.BLUE, 0.1, 29.9, 15, 95)); gradParms.add(new GradientParameters(Color.BLUE, Color.GREEN, 30, 29.9, 10, 95)); gradParms.add(new GradientParameters(Color.GREEN, Color.YELLOW, 60.0, 19.9, 10, 95)); gradParms.add(new GradientParameters(Color.YELLOW, Color.decode("#FF0000"), 80.0, 9.9, 10, 95)); gradParms.add(new GradientParameters(Color.decode("#FF0000"), Color.RED, 90.0, 10.0, 10, 95)); }
From source file:com.view.TimeSeriesChartView.java
public JFreeChart getVendorTimeSeriesChart(Excel theExcel, String vendor) { int vendorCode = Integer.parseInt(vendor); ArrayList<Receiving> theReceiving = theExcel.getSheetReceiving(); // HashMap<Month, Integer> item1Map = new HashMap<>(); // HashMap<Month, Integer> item2Map = new HashMap<>(); // HashMap<Month, Integer> item3Map = new HashMap<>(); Set vendorItem = new HashSet(); for (int i = 0; i < theReceiving.size(); i++) { vendorItem.add(theReceiving.get(i).getItem()); }//from w w w .ja va 2 s. co m TimeSeries data[] = new TimeSeries[vendorItem.size()]; HashMap<Month, Integer> itemMap[] = new HashMap[vendorItem.size()]; for (int i = 0; i < vendorItem.size(); i++) { String itemName = "item" + i; data[i] = new TimeSeries(itemName); itemMap[i] = new HashMap<>(); } Calendar cal = Calendar.getInstance(); for (int i = 0; i < theReceiving.size(); i++) { cal.setTime(theReceiving.get(i).getDate()); int month = cal.get(Calendar.MONTH) + 1; int year = cal.get(Calendar.YEAR); int quantity = 0; if (theReceiving.get(i).getVendor() == vendorCode) { quantity = theReceiving.get(i).getQuantity(); Month theMonth = new Month(month, year); int itemNum = theReceiving.get(i).getItem() - 1; itemMap[itemNum].put(theMonth, updateItemMap(itemMap[itemNum], theMonth, quantity)); } } TimeSeriesCollection my_data_series = new TimeSeriesCollection(); for (int i = 0; i < vendorItem.size(); i++) { for (Map.Entry<Month, Integer> entry : itemMap[i].entrySet()) { data[i].add(entry.getKey(), entry.getValue()); } my_data_series.addSeries(data[i]); } JFreeChart chart = ChartFactory.createTimeSeriesChart("Receiving", "Month", "Quantity", my_data_series, true, true, false); chart.setBackgroundPaint(Color.YELLOW); XYPlot plot = (XYPlot) chart.getPlot(); plot.setBackgroundPaint(Color.WHITE); plot.setDomainGridlinePaint(Color.GREEN); plot.setRangeGridlinePaint(Color.orange); plot.setAxisOffset(new RectangleInsets(50, 0, 20, 5)); plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer(); renderer.setBaseShapesVisible(true); renderer.setBaseShapesFilled(true); DateAxis axis = (DateAxis) plot.getDomainAxis(); axis.setDateFormatOverride(new SimpleDateFormat("MM.yyyy")); return chart; }
From source file:chart.XYChart.java
public XYChart(String applicationTitle, String chartTitle, double[] xData, double[] YDataAnalitic, double[] YDataNumerical1, double[] YDataNumerical2, double[] YDataNumerical3) { super(applicationTitle); JFreeChart xylineChart = ChartFactory.createXYLineChart(chartTitle, "", "", createDatasetForFour(xData, YDataAnalitic, YDataNumerical1, YDataNumerical2, YDataNumerical3), 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.setSeriesStroke(0, new BasicStroke(1.0f)); renderer.setSeriesStroke(1, new BasicStroke(1.0f)); renderer.setSeriesStroke(2, new BasicStroke(1.0f)); plot.setRenderer(renderer);//from ww w . j a v a2 s .c om setContentPane(chartPanel); // panel.removeAll(); // panel.add(chartPanel); // panel.validate(); }