Something like this: [code] import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.RenderingHints; import java.awt.geom.Arc2D; import java.awt.geom.Path2D;
import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.SwingUtilities; @SuppressWarnings("serial") public class ParallelArcs extends JComponent { @Override protected void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D) g; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); // center of both arcs double x = 100.0; double y = 80.0; // radii of arcs double r1 = 50.0; double r2 = 20.0; // diameters of arcs double d1 = 2 * r1; double d2 = 2 * r2; // start angle and extend double start = -45; double extent = 225; // create arcs Arc2D arc1 = new Arc2D.Double(x - r1, y - r1, d1, d1, start, extent, Arc2D.OPEN); Arc2D arc2 = new Arc2D.Double(x - r2, y - r2, d2, d2, start + extent, -extent, Arc2D.OPEN); // create path that consists of arcs Path2D path2D = new Path2D.Double(); path2D.append(arc1, false); path2D.append(arc2, true); path2D.closePath(); // fill constructed path g2d.fill(path2D); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { JFrame frame = new JFrame("Parallel Arcs"); frame.getContentPane().add(new ParallelArcs()); frame.setSize(200, 200); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); } }); } } [/code] [Message sent by forum member 'kamre' (kamre)] http://forums.java.net/jive/thread.jspa?messageID=334394 =========================================================================== To unsubscribe, send email to lists...@java.sun.com and include in the body of the message "signoff JAVA2D-INTEREST". For general help, send email to lists...@java.sun.com and include in the body of the message "help".