Question: Can someone please manipulate this code so that it yields a unique image. import java.util. * ; import javax.swing. * ; public class drawingBoard 3

Can someone please manipulate this code so that it yields a unique image.
import java.util.*;
import javax.swing.*;
public class drawingBoard3 extends JPanel{
int strokeWeight =3;
public void paintComponent(Graphics g)
{
this.setBackground(Color.white);
this.drawDesignTriangle(g,350,300,100,125);
this.drawDesignCircle(g,250,300,200,90,450);
// this.drawDesignCircle(g,250,300,200,90,450);
}
public void drawDesignTriangle(Graphics g, int xCenter, int yCenter, int halfWidth,int degrees)
{
Graphics2D g2=(Graphics2D)g;
g2.setStroke(new BasicStroke(strokeWeight));
int angle =0;
int angleIncr =5;
int greenVal =0;//create new color
int blueVal =255;//create new color
int redVal =255;//create new color
int maxVal =255;
while(angle maxVal)
{
greenVal =0;
}
}
}
public void drawDesignCircle(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;
int greenVal =0;//create new color
int blueVal =255;//create new color
int redVal =0;//create new color
int maxVal =255;
Graphics2D g2=(Graphics2D)g;
g2.setStroke(new BasicStroke(strokeWeight));
while(angle < maxAngle)
{
Color myColor = new Color(redVal, greenVal, blueVal);
g.setColor(myColor);
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;
redVal+=10;
if(redVal>maxVal)
{
redVal =0;
}
}
}
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 drawingBoard3());
myFrame.setVisible(true);
}

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 Programming Questions!