No sense in starting a new thread when I can just use an old one, right?
Hi there. Beginner programmer here. Here is my question.
I've created an array full of circles (ovals) that go down in size with different colors. What I'm stuck on is having to rotate the colors. I'm supposed to take the center color and move it down one in the array and repeat with each, with the outermost ring color changing to the center. I'm stuck... Here is the code for the circles...
How can I approach this? I tried reading what was written before, but I wasn't able to figure it out...public ArrayList createAPileOfDisks() { // Get the array number of disks from the user Input in = new Input(); int n; do { n = in.readIntDialog("Enter the number of disks " + "(between 1 and " + MAXIMUM_NUMBER_OF_DISKS + ")"); if (n <= 0 || n > MAXIMUM_NUMBER_OF_DISKS) { // display an error message JOptionPane.showMessageDialog(null, "Invalid input", "Input Error", JOptionPane.WARNING_MESSAGE); } } while (n <= 0 || n > MAXIMUM_NUMBER_OF_DISKS); // Create the list of disks ArrayList<Oval> list = new ArrayList<Oval>(n); int chgSize = HEIGHT; for (int i = 1; i <= n; i++) { // Find the center of the window int centerX = (int) (WIDTH / 2) - (chgSize / 2); int centerY = (int) (HEIGHT / 2) - (chgSize / 2); // Draw an Oval Oval o = new Oval(centerX, centerY, chgSize, chgSize, randomColors(), true); list.add(o); chgSize -= WIDTH / n; } return list; } public Color randomColors() { Color c = new Color((int) (Math.random() * 256), ((int) (Math.random() * 256)), ((int) (Math.random() * 256))); return c; }