Write a program that places four fans in a fram of GridLayout with two rows and two columns. I have pasted code below which shows what the "fans" should look like. Thanks!!
// TestArcs.java: Demonstrate drawing 4 arcs ( red fanblades ), in blue circle import javax.swing.JFrame; import javax.swing.JPanel; import java.awt.Color; import java.awt.Graphics;
public class TestArcs extends JFrame {
public TestArcs() { setTitle("Exercise 8.13"); getContentPane().add(new ArcsPanel()); }
public static void main(String[] args) { TestArcs frame = new TestArcs(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(250, 300); frame.setVisible(true); } }
class ArcsPanel extends JPanel {
public void paintComponent(Graphics g) { super.paintComponent(g);
int xCenter = getWidth()/2; int yCenter = getHeight()/2; int radius = (int)(Math.min(getSize().width, getSize().height)*0.4);
int x = xCenter - radius; int y = yCenter - radius;