• Post Reply Bookmark Topic Watch Topic
  • New Topic

nested circles with different colors  RSS feed

 
Mohamad Samy
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the following problem, I want to paint many circles nested in each other but when a new circle is painted it will be with a different color from the previous one so, the result is many circles with two colors
the following code when executed, it gave my only one big circle with the same color, I don't know why

 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That the color is the same every time is understandable - you're only using a single one. You'll have to move lines 14 and 15 into the loop to choose different ones.
 
Paweł Baczyński
Bartender
Posts: 1998
42
Firefox Browser IntelliJ IDE Java Linux Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Draw them in order from biggest to lowest. Not from lowest to biggest.
 
Mohamad Samy
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what a trick. thanks man for good tip.
 
Campbell Ritchie
Sheriff
Posts: 53779
128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It should be obvious. Try it with circles of coloured paper and it becomes obvious you lay the largest one down first.

I am moving this discussion to the GUIs forum.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!