• Post Reply Bookmark Topic Watch Topic
  • New Topic

Draw series of concentric circles

 
rciri serve
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm really stuck on how to go about programming this. Need to draw a series of 8 concentric circles using Java drawArc method with following conditions

using import java.util.Random library

Provide for starting the drawings at random location (i.e., the x-y cooridinate must be calculated randomly).
Provide a random color for each circle
Provide a random diameter for each circle
My current code is able to get random random color for each circle but not clear how to meet other random conditions

 
m Korbel
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
- the same answer as comment with linked code example to use drawOval,

- override getPreferredSize in ConcentricCircles

- all coordinates for paintComponent, Random, etc are from getHeight/Weight

- Graphics could be resizable (or not) with container (ConcentricCircles)
 
rciri serve
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
m Korbel wrote:- the same answer as comment with linked code example to use drawOval,

- override getPreferredSize in ConcentricCircles

- all coordinates for paintComponent, Random, etc are from getHeight/Weight

- Graphics could be resizable (or not) with container (ConcentricCircles)


Sorry - Could you give an example ?. I have a requirement to use drawArc method only.
 
m Korbel
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you give an example ?. I have a requirement to use drawArc method only.

I think linked code by @trashgod "caused" all my a.m. points
 
m Korbel
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think that answered
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!