import java.awt.*; public class Main extends Frame { public void paint(Graphics g) { g.setColor(Color.red); g.fillArc(50, 50, 150, 150, 0, 180); } public static void main(String[] args) { Main m = new Main(); m.setSize(250, 250); m.setVisible(true); } }
import java.awt.*; public class Main extends Frame { public void paint(Graphics g) { g.setColor(Color.red); g.fillArc(50, 50, 150, 150, 0, 30); g.setColor(Color.orange); g.fillArc(50, 50, 150, 150, 30, 30); g.setColor(Color.yellow); g.fillArc(50, 50, 150, 150, 60, 30); g.setColor(Color.green); g.fillArc(50, 50, 150, 150, 90, 30); g.setColor(Color.blue); g.fillArc(50, 50, 150, 150, 120, 30); g.setColor(new Color(128, 0, 128)); g.fillArc(50, 50, 150, 150, 150, 30); } public static void main(String[] args) { Main m = new Main(); m.setSize(250, 250); m.setVisible(true); } }
import java.awt.*; public class Main extends Frame { public void paint(Graphics g) { g.setColor(new Color(51, 204, 51)); g.fillArc(50, 50, 150, 150, 0, 270); g.setColor(Color.white); g.fillArc(60, 60, 130, 130, 0, 270); g.setColor(Color.black); g.setFont(new Font("Arial", Font.BOLD, 20)); g.drawString("75%", 100, 125); } public static void main(String[] args) { Main m = new Main(); m.setSize(250, 250); m.setVisible(true); } }In each of these examples, the java.awt package is imported to use the Graphics class and fillArc() method to draw and fill arcs of different colors on a frame.