• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Draw series of concentric circles

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

 
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think that answered
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic