List of usage examples for java.awt Graphics2D drawArc
public abstract void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle);
From source file:org.jfree.graphics2d.demo.ImageTest.java
private static void drawArcTest(Graphics2D g2) { g2.setPaint(Color.GREEN);/*from www . j a v a2 s. c o m*/ g2.drawRect(0, 20, 70, 50); g2.setPaint(Color.RED); Path2D path1 = new Path2D.Double(); double[] pts = calculateReferenceArc(90); path1.moveTo(pts[0], pts[1]); path1.curveTo(pts[2], pts[3], pts[4], pts[5], pts[6], pts[7]); AffineTransform t = new AffineTransform(); t.translate(35, 45); t.scale(35, 25); t.rotate(Math.PI / 4); path1.transform(t); g2.draw(path1); Path2D path2 = new Path2D.Double(); path2.moveTo(pts[0], pts[1]); path2.curveTo(pts[2], pts[3], pts[4], pts[5], pts[6], pts[7]); AffineTransform t2 = new AffineTransform(); t2.rotate(3 * Math.PI / 4); t2.scale(35, 25); t2.translate(35, 35); path2.transform(t2); //g2.draw(path2); Path2D arc = new Path2D.Double(); arc.append(path1, false); arc.append(path2, false); //g2.draw(arc); //g2.draw(path1); //g2.transform(t); g2.setPaint(Color.BLUE); g2.drawArc(0, 20, 70, 50, 0, -270); //Arc2D arc2d = new Arc2D.Double(0d, 20d, 70d, 50d, 0d, 90, Arc2D.OPEN); //g2.draw(arc2d); }
From source file:facebean.FaceBean.java
@Override public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); // Face//from ww w . j a va 2 s.c o m int w = getWidth(); int h = getHeight(); int pad = 12; int cw = w - pad * 2; int ch = h - pad * 2; g2.setColor(getBackground()); g2.fillArc(pad, pad, cw, ch, 0, 360); g2.setColor(getForeground()); g2.drawArc(pad, pad, cw, ch, 0, 360); // Mouth int sw = cw / 2; int sh = ch / 2; if (mSmile == true) g2.drawArc(w / 2 - sw / 2, h / 2 - sh / 2, sw, sh, 270 - mMouthWidth / 2, mMouthWidth); else g2.drawArc(w / 2 - sw / 2, h / 2 + sh / 3, sw, sh, 90 - mMouthWidth / 2, mMouthWidth); // Eyes int er = 4; g2.fillArc(w / 2 - cw * 1 / 8 - er / 2, h / 2 - ch / 4 - er, er, er, 0, 360); g2.fillArc(w / 2 + cw * 1 / 8 - er / 2, h / 2 - ch / 4 - er, er, er, 0, 360); }
From source file:org.jcurl.core.swing.RockEditDisplay.java
protected static void circleDC(final Graphics2D g, final Point2D center, final int radius) { final int cx = (int) center.getX(); final int cy = (int) center.getY(); g.drawArc(cx - radius, cy - radius, 2 * radius, 2 * radius, 0, 360); }
From source file:org.jcurl.core.swing.SumDisplayBase.java
protected void paintRock(final Graphics2D g2, final int idx8, final boolean isDark) { final float r = 0.35F * getWidth(); // vertical display: final float cx = 0.5F * getWidth(); float cy = getHeight() / RockSet.ROCKS_PER_SET; if (isDark)//from w w w .j av a 2 s . co m cy *= idx8 + 0.5F; else cy *= RockSet.ROCKS_PER_SET - (idx8 + 0.5F); g2.setPaint(isDark ? colors.dark : colors.light); g2.fillArc((int) (cx - r), (int) (cy - r), (int) (2 * r), (int) (2 * r), 0, 360); g2.setColor(Color.BLACK); g2.drawArc((int) (cx - r), (int) (cy - r), (int) (2 * r), (int) (2 * r), 0, 360); }
From source file:se.trixon.almond.GraphicsHelper.java
public static void drawCircleSector(int x, int y, int radius, int start, int stop, Graphics2D graphics2D) { graphics2D.drawArc(x - radius, y - radius, radius * 2, radius * 2, start, stop); }