List of usage examples for java.awt Graphics2D draw
public abstract void draw(Shape s);
From source file:Main.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; int w = getSize().width; int h = getSize().height; Arc2D arc = new Arc2D.Double(0.0, 0.5, w, h, 0.0, 60.0, Arc2D.CHORD); System.out.println(arc.getPathIterator(AffineTransform.getQuadrantRotateInstance(5))); g2.draw(arc); arc = new Arc2D.Float(0.0f, 0.0f, w, h, 80.0f, 110.0f, Arc2D.PIE); g2.fill(arc);//from ww w. ja v a 2 s. co m arc = new Arc2D.Float(0.0f, 0.0f, w, h, 210.0f, 130.0f, Arc2D.OPEN); g2.draw(arc); }
From source file:de.h_da.fbi.rfid.gui.UHF_GUI.java
public void paintComponent(Graphics g) { super.paint(g); Graphics2D g2 = (Graphics2D) g; Line2D line = new Line2D.Double(300, 300, 80, 80); g2.setStroke(new BasicStroke(4)); g2.draw(line); }
From source file:Main.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; int w = getSize().width; int h = getSize().height; Arc2D arc = new Arc2D.Double(0.0, 0.0, w, h, 0.0, 60.0, Arc2D.CHORD); System.out.println(arc.equals(new Arc2D.Double(0.0, 0.0, w, h, 0.0, 60.0, Arc2D.CHORD))); g2.draw(arc); arc = new Arc2D.Float(0.0f, 0.0f, w, h, 80.0f, 110.0f, Arc2D.PIE); g2.fill(arc);/* www . ja v a 2s . c o m*/ arc = new Arc2D.Float(0.0f, 0.0f, w, h, 210.0f, 130.0f, Arc2D.OPEN); g2.draw(arc); }
From source file:org.evors.rs.unibot.sim.SimulatedUnibot.java
@Override public void render(Graphics2D g2) { g2.setColor(new Color(45, 45, 45)); g2.fill(getShape().toJava2DShape()); g2.setStroke(bstroke);// www .ja v a 2 s .c om g2.setColor(Color.RED); g2.draw(getShortenedRangeFinderLine().toLine2D()); }
From source file:BezLab.java
public void paint(Graphics g) { for (int i = 0; i < 4; i++) { if (i == 0 || i == 3) g.setColor(Color.blue); else/*from w ww. ja v a2s. com*/ g.setColor(Color.cyan); g.fillOval(xs[i] - 6, ys[i] - 6, 12, 12); } Graphics2D g2d = (Graphics2D) g; g2d.setColor(Color.black); GeneralPath path = new GeneralPath(); path.moveTo(xs[0], ys[0]); path.curveTo(xs[1], ys[1], xs[2], ys[2], xs[3], ys[3]); g2d.draw(path); }
From source file:dataminning2.Graphplot.java
protected void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D) g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); int w = getWidth(); int h = getHeight(); // Draw ordinate. g2.draw(new Line2D.Double(PAD, PAD, PAD, h - PAD)); // Draw abcissa. g2.draw(new Line2D.Double(PAD, h - PAD, w - PAD, h - PAD)); double xInc = (double) (w - 2 * PAD) / (data.length - 1); double scale = (double) (h - 2 * PAD) / 88; // Mark data points. g2.setPaint(Color.red);//from w w w. ja va 2 s .co m int length1 = 0; int length2 = data.length / 3; for (int i = 0; i < length2; i++) { double x = PAD + i * dataX[i]; double y = h - PAD - scale * dataY[i]; g2.fill(new Ellipse2D.Double(x - 2, y - 2, 4, 4)); } g2.setPaint(Color.BLUE); int lengthnew = length1 + length2; length2 = length2 + lengthnew; for (int i = lengthnew; i < length2; i++) { double x = PAD + i * dataX[i]; double y = h - PAD - scale * dataY[i]; g2.fill(new Ellipse2D.Double(x - 2, y - 2, 4, 4)); } g2.setPaint(Color.YELLOW); lengthnew = lengthnew + lengthnew; for (int i = length2; i < data.length; i++) { double x = PAD + i * dataX[i]; double y = h - PAD - scale * dataY[i]; g2.fill(new Ellipse2D.Double(x - 2, y - 2, 4, 4)); } }
From source file:MyCanvas.java
public void draw(Graphics g) { Graphics2D g2 = (Graphics2D) g; // Draw the pie chart Arc2D.Float arc = new Arc2D.Float(Arc2D.PIE); arc.setFrame(140, 200, 67, 46);// ww w . ja v a 2 s. co m arc.setAngleStart(45); arc.setAngleExtent(270); g2.setColor(Color.gray); g2.draw(arc); g2.setColor(Color.red); g2.fill(arc); g2.setColor(Color.black); g2.drawString("Arc2D.PIE", 140, 190); }
From source file:Hypnosis1.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); Shape s = createShape();/* ww w .j a v a 2s .c om*/ g2.setPaint(paint); g2.fill(s); g2.setPaint(Color.white); g2.draw(s); }
From source file:Overlap.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; double x = 15, y = 50, w = 70, h = 70; Ellipse2D e = new Ellipse2D.Double(x, y, w, h); g2.setStroke(new BasicStroke(8)); Color smokeyColor = new Color(128, 128, 128, 128); g2.setPaint(smokeyColor);//from w ww . ja v a 2 s.c om g2.fill(e); g2.draw(e); e.setFrame(x + 100, y, w, h); g2.setPaint(Color.black); g2.draw(e); g2.setPaint(Color.gray); g2.fill(e); e.setFrame(x + 200, y, w, h); g2.setPaint(Color.gray); g2.fill(e); g2.setPaint(Color.black); g2.draw(e); }
From source file:dataminning2.DBScanGraphplot.java
protected void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D) g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); int w = getWidth(); int h = getHeight(); // Draw ordinate. g2.draw(new Line2D.Double(PAD, PAD, PAD, h - PAD)); // Draw abcissa. g2.draw(new Line2D.Double(PAD, h - PAD, w - PAD, h - PAD)); double xInc = (double) (w - 2 * PAD) / (data.length - 1); double scale = (double) (h - 2 * PAD) / 88; // Mark data points. g2.setPaint(Color.red);/*from ww w . jav a 2 s .com*/ int length1 = 0; int length2 = data.length / 3; for (int i = 0; i < data.length; i++) { double x = PAD + i * dataX[i]; double y = h - PAD - scale * dataY[i]; g2.fill(new Ellipse2D.Double(x - 2, y - 2, 4, 4)); } }