Hello
I need help with this exercise. I hope someone can help me.
I need to create a program that draws circles in the middle of a DrawingPanel and draw them in different colors from red to blue via green. The program will ask the user how many circles to be drawn out and then plot them. Part of the program should be a method drawColoredCircles that draws circles, another part asks the user how many people will be drawn out. The circles should be drawn up from the inside out, they should be completely symmetrical circles and not ovals, and they should be drawn up for each other delays. Each circle should be larger than the previous one and the circles color codes will vary so that the transitions between the three primary colors are as soft as possible.
Use it properly documented version of DrawingPanel.java for this task.
I allready have this code but I don't know how to continue from it.
public static void main(String[] args) {
DrawingPanel panel = new DrawingPanel(500, 400);
Graphics2D g = panel.getGraphics();
int distance = 10;
int max = 16;
for (int i = 0; i < max; i++) {
g.setColor(new Color(255 - i, 0, i));
g.setStroke(new BasicStroke(2));
int width = 10 + i * distance;
g.drawOval(0, 0, width, width);
}
}
These are the steps i need to do after:
Step 2 I need to extend the code so it just don't make circles that goes from red to blue but it goes also from red to blue via green. "Use a for loop and an if statement in the loop to determine if one is to mix red and green or green and blue."
Step 3 I need a delay between each circle so that i can see when they are drawn up. And the program should also ask the user how many circles to be plotted
This is how it is supposed to look like after all is done.
thanks in advance.