0

I would like to make an applet which displays a "Bold circle", like a series of concentric circles which give as a result a more "thick" circumference.

I have tried this two ways but they don't really work:

import java.awt.Graphics;
import javax.swing.JApplet;


public class BoldCircle extends JApplet
{
   public void paint(Graphics canvas)
   {
      int i;

      for(i=150; i < 160; i++)
         canvas.drawOval(200, 200, i, i);  


      for(i=500; i < 510; i++)
         canvas.drawOval(  i,   i, 150, 150);
   }

}

Program output

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
IDK
  • 359
  • 1
  • 16
  • See https://stackoverflow.com/a/6110920/2055998 – PM 77-1 Oct 06 '17 at 17:42
  • The basic answer to the question is *"Use a **`Graphics2D`** instance and set a thick `Stroke` for drawing"*. On other matters: 1) Why code an applet? If it is due to the teacher specifying it, please refer them to [Why CS teachers should **stop** teaching Java applets](http://programmers.blogoverflow.com/2013/05/why-cs-teachers-should-stop-teaching-java-applets/). 2) Why use AWT? See [this answer](http://stackoverflow.com/questions/6255106/java-gui-listeners-without-awt/6255978#6255978) for many good reasons to abandon AWT components in favor of Swing. Note that Swing offers a .. – Andrew Thompson Oct 07 '17 at 04:07
  • **`Graphics2D`** object for custom painting (which is done in the `paintComponent(..)` method rather than the `paint(..)` method like AWT). – Andrew Thompson Oct 07 '17 at 04:08

0 Answers0