Question: Can someone please edit this code so that it creates a rotating object that meets this criteria? import java.awt.BasicStroke; import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics

Can someone please edit this code so that it creates a rotating object that meets this criteria?
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import javax.swing.*;
public class DrawingBoard extends JPanel {
int strokeWeight =2;
public void paintComponent(Graphics g)
{
this.setBackground(Color.white);
drawDesign(g,250,300,200,0,360);//90 to get a quarter of reef.
//360 to get full reef
//to get top half change starting position
drawDesign(g,250,300,200,90,450);
drawDesign(g,250,300,200,180,540);
}
public void drawDesign(Graphics g, int xCenter, int yCenter, int radius//how far from center shape will be,for spiral radius decreases through loop
,
int angle, int maxAngle)//progression of drawing shapes overlapping each other
{
int angleIncrement =5;//amount of the angular position change
int size =48;//width of the circleit
int radiusIncr =4;
int sizeIncr =1;
Graphics2D g2=(Graphics2D)g;
g2.setStroke(new BasicStroke(strokeWeight));
while(angle maxAngle)
{
int x1= xCenter +(int)(radius *Math.cos(Math.toRadians(angle)));
int y1= yCenter +(int)(radius *Math.sin(Math.toRadians(angle)));
g.drawOval(x1,y1,size,size);
angle += angleIncrement;
radius -= radiusIncr;
size -= sizeIncr;
}
}
public static void main(String[] args)
{
int winWid =900;
int winHie =700;
JFrame myFrame = new JFrame("My Rotation image");
myFrame.setSize(winWid,winHie);
myFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
myFrame.add(new DrawingBoard());
myFrame.setVisible(true);
}
}-20 method does not have parameters that allow for the location of the graphics
prduced by the methods to change as well as change the orientation.
-20 does not use Multiple method callsto the same method with different arguments
made to produce the final design.
-20 does not use of size variation of basic shape
-20 does not use gradual change in a custum color
Can someone please edit this code so that it

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!