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:application.BrokersMouseListener.java
@Override public void graphClicked(Object arg0, MouseEvent arg1) { //Reset the selected variable for all the broker ListIterator<Broker> it = state.getBrokersList(); while (it.hasNext()) { it.next().resetSelected();/*from ww w. j a v a 2 s .com*/ } Broker broker = (Broker) arg0; //SET the selected variable for THE SPECIFIC broker broker.setSelected(); Transformer<Broker, Paint> vertexPaint = new Transformer<Broker, Paint>() { public Paint transform(Broker b) { if (b.selected()) { return Color.GREEN; } return Color.GRAY; } }; //Reset the selected variable for all the link it = state.getBrokersList(); while (it.hasNext()) { Broker b = it.next(); ListIterator<Interface> intit = b.getInterfaces(); while (intit.hasNext()) { Interface ix = intit.next(); ix.getLink().resetSelected(); } } //SET the selected variable for THE SPECIFIC links it = state.getBrokersList(); while (it.hasNext()) { Broker b = it.next(); ListIterator<Interface> intit = b.getInterfaces(); if (b.equals(broker)) { while (intit.hasNext()) { Interface ix = intit.next(); ix.getLink().setSelected(); } } else { while (intit.hasNext()) { Interface ix = intit.next(); ix.getLink().setSelectedBcastFunction(state.getBrokerPosition(broker)); } } } Transformer<Link, Stroke> edgeStrokeTransformer = new Transformer<Link, Stroke>() { public Stroke transform(Link link) { if (link.selected()) { final Stroke edgeStroke = new BasicStroke(2); return edgeStroke; } else { float[] dot = { 1.0f, 3.0f }; final Stroke edgeStroke = new BasicStroke(1.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, dot, 0f); return edgeStroke; } } }; vv.getRenderContext().setVertexFillPaintTransformer(vertexPaint); vv.getRenderContext().setEdgeStrokeTransformer(edgeStrokeTransformer); //((FRLayout)layout).initialize(); //((FRLayout)layout).step(); vv.repaint(); }
From source file:com.crunchify.jsp.servlet.BarServlet.java
public JFreeChart getChart() { DefaultCategoryDataset dataset = new DefaultCategoryDataset(); dataset.addValue(15, "1", "451"); dataset.addValue(12, "1", "851"); dataset.addValue(10, "2", "362"); dataset.addValue(5, "2", "142"); JFreeChart chart = ChartFactory.createBarChart("Bar Chart Demo 3", // chart title "Category", // domain axis label "Value", // range axis label dataset, // data PlotOrientation.VERTICAL, // the plot orientation false, // include legend true, false);//from w w w .j a va 2s . c o m chart.setBackgroundPaint(Color.lightGray); // get a reference to the plot for further customisation... CategoryPlot plot = chart.getCategoryPlot(); plot.setNoDataMessage("NO DATA!"); CategoryItemRenderer renderer = new CustomRenderer(new Paint[] { Color.red, Color.blue, Color.green, Color.yellow, Color.orange, Color.cyan, Color.magenta, Color.blue }); renderer.setItemLabelsVisible(true); ItemLabelPosition p = new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER, TextAnchor.CENTER, 45.0); renderer.setPositiveItemLabelPosition(p); plot.setRenderer(renderer); // change the margin at the top of the range axis... ValueAxis rangeAxis = plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); rangeAxis.setLowerMargin(0.15); rangeAxis.setUpperMargin(0.15); return chart; }
From source file:org.jfree.chart.demo.MemoryUsageDemo.java
public MemoryUsageDemo(int i) { super(new BorderLayout()); total = new TimeSeries("Total Memory"); total.setMaximumItemAge(i);//from w ww . j a va 2 s . c o m free = new TimeSeries("Free Memory"); free.setMaximumItemAge(i); TimeSeriesCollection timeseriescollection = new TimeSeriesCollection(); timeseriescollection.addSeries(total); timeseriescollection.addSeries(free); DateAxis dateaxis = new DateAxis("Time"); NumberAxis numberaxis = new NumberAxis("Memory"); dateaxis.setTickLabelFont(new Font("SansSerif", 0, 12)); numberaxis.setTickLabelFont(new Font("SansSerif", 0, 12)); dateaxis.setLabelFont(new Font("SansSerif", 0, 14)); numberaxis.setLabelFont(new Font("SansSerif", 0, 14)); XYLineAndShapeRenderer xylineandshaperenderer = new XYLineAndShapeRenderer(true, false); xylineandshaperenderer.setSeriesPaint(0, Color.red); xylineandshaperenderer.setSeriesPaint(1, Color.green); xylineandshaperenderer.setSeriesStroke(0, new BasicStroke(3F, 0, 2)); xylineandshaperenderer.setSeriesStroke(1, new BasicStroke(3F, 0, 2)); XYPlot xyplot = new XYPlot(timeseriescollection, dateaxis, numberaxis, xylineandshaperenderer); xyplot.setBackgroundPaint(Color.lightGray); xyplot.setDomainGridlinePaint(Color.white); xyplot.setRangeGridlinePaint(Color.white); xyplot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D)); dateaxis.setAutoRange(true); dateaxis.setLowerMargin(0.0D); dateaxis.setUpperMargin(0.0D); dateaxis.setTickLabelsVisible(true); numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); JFreeChart jfreechart = new JFreeChart("JVM Memory Usage", new Font("SansSerif", 1, 24), xyplot, true); jfreechart.setBackgroundPaint(Color.white); ChartPanel chartpanel = new ChartPanel(jfreechart, true); chartpanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4), BorderFactory.createLineBorder(Color.black))); add(chartpanel); }
From source file:ws.moor.bt.gui.charts.BlockOrigin.java
private JFreeChart createChart(PieDataset dataset) { JFreeChart chart = ChartFactory.createPieChart3D("Block Origin", dataset, false, false, false); chart.setBackgroundPaint(Color.white); ((PiePlot3D) chart.getPlot()).setSectionPaint(0, Color.YELLOW); ((PiePlot3D) chart.getPlot()).setSectionPaint(0, Color.GREEN); return chart; }
From source file:org.jfree.graphics2d.demo.ImageTest.java
private static void drawRadialGradientPaintTest(Graphics2D g2) { RadialGradientPaint rgp = new RadialGradientPaint(50, 50, 40, 30, 30, new float[] { 0f, 0.75f, 1f }, new Color[] { Color.RED, Color.GREEN, Color.BLUE }, MultipleGradientPaint.CycleMethod.NO_CYCLE); g2.setPaint(rgp);//w w w . j av a2 s . c o m Ellipse2D circle = new Ellipse2D.Double(10, 10, 80, 80); g2.fill(circle); }
From source file:de.berlios.statcvs.xml.report.AuthorsActivityChart.java
public AuthorsActivityChart(CvsContent content, ReportSettings settings) { super(settings, "activity.png", I18n.tr("Author Activity"), null, "%"); CategoryPlot plot = getChart().getCategoryPlot(); plot.getRenderer().setSeriesPaint(REMOVING, Color.red); plot.getRenderer().setSeriesPaint(CHANGING, Color.yellow); plot.getRenderer().setSeriesPaint(ADDING, Color.green); plot.getRangeAxis().setUpperBound(100); Collection auts = content.getAuthors(); Iterator it = auts.iterator(); while (it.hasNext()) { Author author = (Author) it.next(); authors.add(author.getName());//from w w w. j a va 2 s . com } Collections.sort(authors); double[][] categories; categories = new double[3][authors.size()]; for (int j = 0; j < authors.size(); j++) { categories[REMOVING][j] = 0; categories[CHANGING][j] = 0; categories[ADDING][j] = 0; } Iterator revIt = settings.getRevisionIterator(content); CommitListBuilder commitList = new CommitListBuilder(revIt); List commits = commitList.createCommitList(); Iterator commitIt = commits.iterator(); while (commitIt.hasNext()) { Commit commit = (Commit) commitIt.next(); Set commitRevList = commit.getRevisions(); Iterator commitRevIt = commitRevList.iterator(); int author = authors.indexOf(commit.getAuthor().getName()); int linesAdded = 0; int linesRemoved = 0; while (commitRevIt.hasNext()) { CvsRevision revision = (CvsRevision) commitRevIt.next(); linesAdded += revision.getNewLines(); linesRemoved += revision.getNewLines() - revision.getReplacedLines(); } if (linesAdded == linesRemoved) { categories[CHANGING][author] += linesAdded; } if (linesAdded < linesRemoved) { categories[CHANGING][author] += linesAdded; categories[REMOVING][author] += linesRemoved - linesAdded; } if (linesAdded > linesRemoved) { categories[ADDING][author] += linesAdded - linesRemoved; categories[CHANGING][author] += linesRemoved; } } for (int i = 0; i < authors.size(); i++) { double maxLines = categories[REMOVING][i] + categories[CHANGING][i] + categories[ADDING][i]; for (int k = 0; k < 3; k++) { categories[k][i] *= (100 / maxLines); dataset.addValue(categories[k][i], topics[k], (String) authors.get(i)); } } setup(true); }
From source file:IHM.compargraph.java
/** * * @param title//from w w w .j a v a 2s .com * @param c1 * @param c2 * @param comp * */ public compargraph(String title, ArrayList<ReleveMeteo> c1, ArrayList<ReleveMeteo> c2, String comp) { super(title); t1 = c1; t2 = c2; c = comp; // jp = new JInternalFrame("courbes"); JFreeChart chart = createChart(createDataset()); ChartPanel panel = new ChartPanel(chart); panel.setPreferredSize(new Dimension(500, 300)); setContentPane(panel); // jp.add(panel, BorderLayout.EAST); // jp.setVisible(true); panel.setVisible(true); XYPlot plot = chart.getXYPlot(); XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); plot.setRenderer(renderer); renderer.setSeriesPaint(0, Color.RED); renderer.setSeriesPaint(1, Color.GREEN); renderer.setSeriesPaint(2, Color.YELLOW); // sets thickness for series (using strokes) renderer.setSeriesStroke(0, new BasicStroke(4.0f)); renderer.setSeriesStroke(1, new BasicStroke(3.0f)); renderer.setSeriesStroke(2, new BasicStroke(2.0f)); plot.setRenderer(renderer); plot.setOutlinePaint(Color.BLUE); plot.setOutlineStroke(new BasicStroke(2.0f)); plot.setBackgroundPaint(Color.DARK_GRAY); plot.setRangeGridlinesVisible(true); plot.setRangeGridlinePaint(Color.BLACK); plot.setDomainGridlinesVisible(true); plot.setDomainGridlinePaint(Color.BLACK); }
From source file:com.leonarduk.finance.analysis.BuyAndSellSignalsToChart.java
/** * Runs a strategy over a time series and adds the value markers * corresponding to buy/sell signals to the plot. * * @param series/*from w w w . jav a2 s.com*/ * a time series * @param strategy2 * a trading strategy * @param plot * the plot */ private static void addBuySellSignals(final TimeSeries series, final AbstractStrategy strategy2, final XYPlot plot) { // Running the strategy final List<Trade> trades = series.run(strategy2.getStrategy()).getTrades(); // Adding markers to plot for (final Trade trade : trades) { // Buy signal final double buySignalTickTime = new Minute( series.getTick(trade.getEntry().getIndex()).getEndTime().toDate()).getFirstMillisecond(); final Marker buyMarker = new ValueMarker(buySignalTickTime); buyMarker.setPaint(Color.GREEN); buyMarker.setLabel("B"); plot.addDomainMarker(buyMarker); // Sell signal final double sellSignalTickTime = new Minute( series.getTick(trade.getExit().getIndex()).getEndTime().toDate()).getFirstMillisecond(); final Marker sellMarker = new ValueMarker(sellSignalTickTime); sellMarker.setPaint(Color.RED); sellMarker.setLabel("S"); plot.addDomainMarker(sellMarker); } }
From source file:statistic.graph.JChartPanel.java
protected static JFreeChart createChart() { stepDataset = new XYSeriesCollection(); linearDataset = new XYSeriesCollection(); chart = ChartFactory.createXYLineChart("Fluss", "Zeiteinheiten", "Flusseinheiten", stepDataset, PlotOrientation.VERTICAL, true, true, false); chart.setBackgroundPaint(Color.WHITE); plot = (XYPlot) chart.getPlot();/* www .j a v a2s . co m*/ plot.setBackgroundPaint(Color.LIGHT_GRAY); 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); plot.setDataset(0, stepDataset); plot.setDataset(1, linearDataset); XYItemRenderer r = plot.getRenderer(); //r.setBaseOutlinePaint(Color.BLACK); //r.setBasePaint(); //r.setItemLabelPaint(); //r.setOutlinePaint(Color.BLACK); //r.setSeriesItemLabelPaint(); //r.setSeriesOutlinePaint(); r.setSeriesPaint(0, Color.GREEN.darker()); r.setSeriesPaint(1, Color.MAGENTA.darker()); if (r instanceof XYLineAndShapeRenderer) { XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) r; renderer.setBaseShapesVisible(true); renderer.setBaseShapesFilled(true); } //XYStepRenderer r3 = new XYStepRenderer(); //r.setBaseOutlinePaint(Color.BLACK); //r.setBasePaint(); //r.setItemLabelPaint(); //r.setOutlinePaint(Color.BLACK); //r.setSeriesItemLabelPaint(); //r.setSeriesOutlinePaint(); //r3.setSeriesPaint(0, Color.BLACK); //r3.setShapesVisible(true); //r3.setShapesFilled(true); //r3.setSeriesShapesFilled(0,true); //r3.set //r3.setSeriesStroke(0, new BasicStroke(2.0f)); XYItemRenderer r2 = new XYStepRenderer(); r2.setSeriesPaint(2, Color.BLACK); plot.setRenderer(r2); plot.setRenderer(1, r); //plot.setRenderer(2, r3); plot.getDomainAxis().setStandardTickUnits(NumberAxis.createIntegerTickUnits()); plot.getDomainAxis().setRange(-0.5, 10); plot.getRangeAxis().setStandardTickUnits(NumberAxis.createIntegerTickUnits()); plot.getRangeAxis().setRange(-0.5, 8.5); return chart; }
From source file:wsattacker.plugin.intelligentdos.ui.helper.ChartHelper.java
public static JFreeChart createOverlaidChart(SuccessfulAttack sa) { // create subplot 1... final XYSeries data1 = createDatasetResponseTime(RequestType.UNTAMPERED, sa.getUntamperedMetrics()); final XYSeries data2 = createDatasetResponseTime(RequestType.TAMPERED, sa.getTamperedMetrics()); final XYSeries data3 = createDatasetResponseTime(RequestType.TESTPROBES, sa.getTestProbes()); final XYSeriesCollection collection = new XYSeriesCollection(); collection.addSeries(data1);//from w w w .j a va 2s . co m collection.addSeries(data2); collection.addSeries(data3); final XYItemRenderer renderer = new StandardXYItemRenderer(); final NumberAxis rangeAxis1 = new NumberAxis("duration in ms"); final XYPlot plot = new XYPlot(collection, new NumberAxis(""), rangeAxis1, renderer); plot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT); renderer.setSeriesPaint(0, Color.GREEN); renderer.setSeriesPaint(1, Color.RED); renderer.setSeriesPaint(2, Color.BLUE); // return a new chart containing the overlaid plot... return new JFreeChart("", JFreeChart.DEFAULT_TITLE_FONT, plot, true); }