Question: I'm tring to get my code to draw this This is my code; import java.awt.*; public class BullsEye { public static void main(String[] args) {
I'm tring to get my code to draw this
This is my code;
import java.awt.*;
public class BullsEye { public static void main(String[] args) {
showOrbital(600, 600); } public static void showOrbital(int x, int y){ DrawingPanel panel = new DrawingPanel(x, y); Graphics g = panel.getGraphics(); g.setColor(Color.RED); g.fillRect(0, 0, x, y); g.setColor(Color.BLACK); for(int i = 4; i > 0; i--){ if(i == 1 || i == 3 || i == 5) { g.setColor(Color.WHITE); g.drawOval( i*25, i*25, x- 50*i, y - 50*i); }
else if(i == 2 || i == 4){ g.setColor(Color.BLACK); g.drawOval( i*25, i*25, x- 50*i, y - 50*i); } } } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
