Given task is to draw an Olympic symbol in Java Applet.
Expected Output:

Approach:
Use drawOval() method to draw a circle with x and y coordinates and length and breadth.
Below is the implementation of the above approach:
Applet Program:
// Java program to Draw an Olympic // Symbol using Java Applet import java.awt.*; import java.applet.*; public class Olympics extends Applet { public void paint(Graphics g) { g.setColor(Color.BLUE); g.drawOval(30, 30, 30, 30); g.setColor(Color.YELLOW); g.drawOval(50, 45, 30, 30); g.setColor(Color.BLACK); g.drawOval(70, 30, 30, 30); g.setColor(Color.GREEN); g.drawOval(90, 45, 30, 30); g.setColor(Color.RED); g.drawOval(110, 30, 30, 30); } } |
Note: To run the applet in command line use the following commands
> javac Olympics.java > appletviewer Olympics.html
Attention reader! Don’t stop learning now. Get hold of all the important Java and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready.
Recommended Posts:
- Draw a Polygon in Java Applet
- Draw a ellipse and a rectangle in Java Applet
- Draw a Chessboard in Java Applet
- Draw a Smiley in Java Applet
- Java Applet | Draw a line using drawLine() method
- Difference between a Java Application and a Java Applet
- Java Applet Basics
- Java Code for Moving Text | Applet | Thread
- Java Applet | Implementing Flood Fill algorithm
- Java Applet | Digital Stopwatch
- Java Applet | How to display a Digital Clock
- Java Applet | How to display an Analog Clock
- Symbol Table in Compiler
- What does symbol tilde (~) denotes in CSS ?
- How to draw a Clock using StillClock in Java
- How to draw Inscribed circle of a triangle using p5.js ?
- How to draw Horizontal and Vertical lines in an Android App using XML
- Java.util.BitSet class methods in Java with Examples | Set 2
- Java.Lang.Float class in Java
- Java.io.BufferedInputStream class in Java
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

