Java Draw Circles Graphics Applets

Java Draw Circles Graphics Applets

No special or predefined method exists with Graphics class to draw circles. But still, circles can be drawn in three styles using other methods.

  1. Using drawRoundRect()
  2. Using drawOval() – most preferred
  3. Using drawArc()

All the earlier programs like drawing rectangles are illustrated with Frame. Now let us go for applet. Applet includes init(), start() and paint() methods etc. The migration steps from graphics application to applet are available in "Java AWT Radio Buttons – Applet GUI".

Knowledge of "applets" is required to do with this program.

Applet File Name: ThreeStyles.java

HTML file to run the above applet

File Name: ManyStyles.html

Java Draw Circles Graphics Applets

Observe in all the above methods, width and height are kept the same as 90, 90. Output is shown in both browser and appletviewer.

For more practice, another program on graphics with applets is available at Drawing Polygons.

CHECK OUT FOR YOUR ONE STOP DESTINATION

All AWT Components – At a Glance.

Drawing All Java Geometrical Figures.

Leave a Reply

Your email address will not be published. Required fields are marked *