List of usage examples for java.awt Graphics2D fillArc
public abstract void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle);
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 w w w . j a v a 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:Slice.java
void drawPie(Graphics2D g, Rectangle area, Slice[] slices) { double total = 0.0D; for (int i = 0; i < slices.length; i++) { total += slices[i].value;// ww w . j av a2s .c o m } double curValue = 0.0D; int startAngle = 0; for (int i = 0; i < slices.length; i++) { startAngle = (int) (curValue * 360 / total); int arcAngle = (int) (slices[i].value * 360 / total); g.setColor(slices[i].color); g.fillArc(area.x, area.y, area.width, area.height, startAngle, arcAngle); curValue += slices[i].value; } }
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 .c o 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 fillCircleSector(int x, int y, int radius, int start, int stop, Graphics2D graphics2D) { graphics2D.fillArc(x - radius, y - radius, radius * 2, radius * 2, start, stop); }