Need help overlapping circles - Olympic Logo -

I am asked to draw the Olympic logo, I 've drawn the the 5 circles, and cannot get the drawArc function to work- to interlock the 5 circles.

This is what I have gotten so far:

<code>

import java.applet.Applet;
import java.awt.*;

public class Hw5Pr1 extends Applet {
  public void paint(Graphics g) {
        // Blue Ring
    g.setColor(new Color(5, 120, 182));
    g.drawOval(0, 0, 100, 100);
    g.fillOval(0,0, 100, 100);
   
   // Rectangle rect = new Rectangle( 30, 30, 100, 100);
   // Color pn = new Color(5, 120, 182);
   // g.drawArc(pn, rect, 50, 100);
   
    g.setColor(new Color(255, 255, 255));
    g.drawOval(5, 5, 90, 90);
    g.fillOval(5, 5, 90, 90);
    // Black Ring
    g.setColor(new Color(0, 0, 0));
    g.drawOval(110, 0, 100, 100);
    g.fillOval(110, 0, 100, 100);
    g.setColor(new Color(255, 255, 255));
    g.drawOval(115, 5, 90, 90);
    g.fillOval(115, 5, 90, 90);    
    // Red Ring
    g.setColor(new Color(251, 24, 51));
    g.drawOval(220, 0, 100, 100);
    g.fillOval(220, 0, 100, 100);
    g.setColor(new Color(255, 255, 255));
    g.drawOval(225, 5, 90, 90);
    g.fillOval(225, 5, 90, 90);      
    // Yellow Ring
    g.setColor(new Color(255, 173, 26));
    g.drawOval(50, 50, 100, 100);
    g.fillOval(50, 50, 100, 100);
    g.setColor(new Color(255, 255, 255));
    g.drawOval(55, 55, 90, 90);
    g.fillOval(55, 55, 90, 90);      
    // Green Ring
    g.setColor(new Color(12, 137, 73));
    g.drawOval(160, 50, 100, 100);
    g.fillOval(160, 50, 100, 100);
    g.setColor(new Color(255, 255, 255));
    g.drawOval(165, 55, 90, 90);
    g.fillOval(165, 55, 90, 90);  
  }
}

</code>

Could someone please help me draw one arc and I 'll hopefully do the rest.

Thanks
Coconut77840Asked:
Who is Participating?
 
objectsConnect With a Mentor Commented:
You'll need to use Swing to achieve that (without drawing 5 arcs).

Graphics2D g2d = (Graphics2D) g;
g.setStroke(new BasicStroke(5.0));
0
 
Coconut77840Author Commented:
I've been able to figure out how to draw the arc

<code>
    g.setColor(new Color(0, 0, 0));
    g.drawArc(110, 5, 95, 95, 185, 70);
</code>

Now, I need to know how to increase the number of pixels of that Arc, It can be done by drawing 10 arcs, but I guess this is not efficient as it would me quite a while.

Please advice
0
 
Coconut77840Author Commented:
It's outputting a white page.

g.setStroke(new BasicStroke(5.0))   <-- isn't supposed to be g2d.setStroke ?
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
Coconut77840Author Commented:
Got it to work.

Thank you
0
 
objectsCommented:
> g.setStroke(new BasicStroke(5.0))   <-- isn't supposed to be g2d.setStroke ?

oops, yes :)
0
 
Coconut77840Author Commented:
It looks very odd.
I took a snapshop of my desktop so you can get the feeling.

http://lobnan.net/Olympic.gif

Any suggestions?
0
 
objectsCommented:
your filling the middle with white which is overwriting anything under the fill.
0
 
Coconut77840Author Commented:
That's how I am asked to do it.

<quote>
Each ring can be drawn by filling a circle in color and then drawing a smaller white circle over it.
</quote>

Thanks
0
 
objectsCommented:
hmm, can't think how you avoid that affect using that approach.
I would have thought you'd just use drawArc()

maybe ask your lecturer for a clarification.
0
 
Coconut77840Author Commented:
I am re-doing this problem using only drawArc function. Hopefully it will clean up the mess in that logo.
0
All Courses

From novice to tech pro — start learning today.