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:MonteCarloWindowLogic.java
static void drawPointsOnChart(JPanel panelWhenInside, ArrayList<Point2D> convexHull, ArrayList<Point2D> hits, ArrayList<Point2D> miss) { panelWhenInside.removeAll();/*w w w . ja v a 2s . co m*/ panelWhenInside.setLayout(new java.awt.BorderLayout()); XYSeries seriersHits = new XYSeries("Hits"); convertArrayListToXYSeries(seriersHits, hits); XYSeries seriersMiss = new XYSeries("Miss"); convertArrayListToXYSeries(seriersMiss, miss); //TODO refactor this, to handling hits, miss and than convex hull int pairsNumber = 0; if (convexHull != null) pairsNumber = convexHull.size() - 1; XYSeries covnexHullDivideOnPiars[] = new XYSeries[pairsNumber]; for (int i = 0; i < covnexHullDivideOnPiars.length; i++) { covnexHullDivideOnPiars[i] = new XYSeries("Convex hull pair " + i); } if (convexHull != null) { divideOnPairsAndConvertConvexHullIntoSeries(covnexHullDivideOnPiars, convexHull); } // Add the seriersAllPoints to your data set XYSeriesCollection dataset = new XYSeriesCollection(); dataset.addSeries(seriersHits); dataset.addSeries(seriersMiss); for (int i = 0; i < covnexHullDivideOnPiars.length; i++) { dataset.addSeries(covnexHullDivideOnPiars[i]); } // Generate the graph JFreeChart chart = ChartFactory.createXYLineChart(null, // Title null, // x-axis Label null, // y-axis Label dataset, // Dataset PlotOrientation.VERTICAL, // Plot Orientation false, // Show Legend false, // Use tooltips false // Configure chart to generate URLs? ); final XYPlot plot = chart.getXYPlot(); ChartPanel chartPanel = new ChartPanel(chart); XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setSeriesPaint(0, Color.GREEN); renderer.setSeriesLinesVisible(0, false); renderer.setSeriesShape(0, ShapeUtilities.createDiamond(3)); renderer.setSeriesPaint(1, Color.RED); renderer.setSeriesLinesVisible(1, false); renderer.setSeriesShape(1, ShapeUtilities.createDiamond(3)); for (int i = 2; i <= covnexHullDivideOnPiars.length + 1; i++) { renderer.setSeriesPaint(i, Color.black); renderer.setSeriesLinesVisible(i, true); renderer.setSeriesStroke(i, new BasicStroke(1.0f)); } plot.setRenderer(renderer); panelWhenInside.add(chartPanel, BorderLayout.CENTER); panelWhenInside.validate(); }
From source file:edu.scripps.fl.curves.plot.CurvePlotDrawingSupplier.java
public CurvePlotDrawingSupplier() { List<Paint> paints = new ArrayList(); paints.add(Color.GREEN); paints.add(Color.BLACK);/*ww w. j ava2 s . c om*/ paints.addAll(Arrays.asList(ChartColor.createDefaultPaintArray())); paintSequence = paints.toArray(new Paint[0]); }
From source file:Main.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); int cx = getSize().width / 2; int cy = getSize().height / 2; g2.translate(cx, cy);/*from w w w .j a va2s . c om*/ g2.rotate(theta * Math.PI / 180); Shape oldClip = g2.getClip(); Shape e = new Ellipse2D.Float(-cx, -cy, cx * 2, cy * 2); g2.clip(e); Shape c = new Ellipse2D.Float(-cx, -cy, cx * 3 / 4, cy * 2); g2.setPaint(new GradientPaint(40, 40, Color.blue, 60, 50, Color.white, true)); g2.fill(c); g2.setPaint(Color.yellow); g2.fillOval(cx / 4, 0, cx, cy); g2.setClip(oldClip); g2.setFont(new Font("Times New Roman", Font.PLAIN, 64)); g2.setPaint(new GradientPaint(-cx, 0, Color.red, cx, 0, Color.black, false)); g2.drawString("Hello, 2D!", -cx * 3 / 4, cy / 4); AlphaComposite ac = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, (float) .75); g2.setComposite(ac); Shape r = new RoundRectangle2D.Float(0, -cy * 3 / 4, cx * 3 / 4, cy * 3 / 4, 20, 20); g2.setStroke(new BasicStroke(4)); g2.setPaint(Color.magenta); g2.fill(r); g2.setPaint(Color.green); g2.draw(r); g2.drawImage(image, -cx / 2, -cy / 2, this); }
From source file:PopUpColorMenu.java
public void actionPerformed(ActionEvent e) { String color = e.getActionCommand(); if (color.equals("Red")) selectedComponent.setBackground(Color.red); else if (color.equals("Green")) selectedComponent.setBackground(Color.green); else if (color.equals("Blue")) selectedComponent.setBackground(Color.blue); }
From source file:me.mayo.telnetkek.ConnectionManager.java
public void triggerConnect(final String hostname, final int port) { final MainPanel btc = TelnetKek.mainPanel; btc.getBtnConnect().setEnabled(false); btc.getTxtServer().setEnabled(false); btc.getBtnDisconnect().setEnabled(true); btc.writeToConsole(new ConsoleMessage("Connecting to " + hostname + ":" + port + "", Color.GREEN)); this.hostname = hostname; this.port = port; this.loginName = null; updateTitle(true);/*from www . ja va 2s.c o m*/ startConnectThread(); }
From source file:org.jfree.chart.demo.AxisOffsetsDemo1.java
private static JFreeChart createChart(String s, CategoryDataset categorydataset) { JFreeChart jfreechart = ChartFactory.createBarChart(s, "Category", "Value", categorydataset, PlotOrientation.VERTICAL, false, true, false); CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot(); categoryplot.setDomainGridlinesVisible(true); 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); return jfreechart; }
From source file:BufferedImageThread.java
AnimationCanvas() { setBackground(Color.green); setSize(450, 400);/*from w ww .j ava 2s.c o m*/ image = getToolkit().getImage("largeJava2sLogo.gif"); MediaTracker mt = new MediaTracker(this); mt.addImage(image, 1); try { mt.waitForAll(); } catch (Exception e) { System.out.println("Exception while loading image."); } if (image.getWidth(this) == -1) { System.out.println("No gif file"); System.exit(0); } rotate = (int) (Math.random() * 360); scale = Math.random() * 1.5; scaleDirection = DOWN; xi = 50.0; yi = 50.0; }
From source file:graphml.vertexPainter.java
public Paint transform(node v) //So for each node that we draw... { //We check the member variable, mColor, of the node. if (v.getColor().equalsIgnoreCase("yellow")) //If the node's mColor value is "yellow" we... return (Color.yellow); // Return our color, Color.yellow. else if (v.getColor().equalsIgnoreCase("red")) return (Color.red); else if (v.getColor().equalsIgnoreCase("blue")) return (Color.blue); else if (v.getColor().equalsIgnoreCase("green")) return (Color.green); else/*from w w w . java 2 s . com*/ return (Color.MAGENTA); }
From source file:com.pureinfo.srm.common.ImageHelper.java
private static Color getColor() { Color[] names = new Color[] { Color.WHITE, Color.RED, Color.GREEN, Color.BLUE, Color.CYAN, Color.DARK_GRAY };// w w w. j a v a2 s.c o m return names[Math.abs(random.nextInt()) % names.length]; }
From source file:URLMonitorPanel.java
public void isAlive(final boolean b) { SwingUtilities.invokeLater(new Runnable() { public void run() { status.setBackground(b ? Color.GREEN : Color.RED); status.repaint();/*ww w. j a v a 2 s . co m*/ } }); }