This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Need to finish my program, but lost Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Need to finish my program, but lost" Watch "Need to finish my program, but lost" New topic

Need to finish my program, but lost

Stephen Norris
Ranch Hand

Joined: Oct 27, 2003
Posts: 44
I have written most of the code, but i have to get a JComboBox to display four shapes (circle, square, oval, and rectangle), then it has to draw that shape in the allotted space. The shapes have to be placed randomly around the window. I don't where in my program to place this part so that it will work and I don't know what to put in there so that it will be random spots. If someone could just help me with the circle part, then I could figure out the other shapes, I think. Here is the program:
Marilyn de Queiroz

Joined: Jul 22, 2000
Posts: 9055
using the paint method (or paintComponent method)

// draw a circle at (330, 15)
graphics.drawRoundRect( 330 , 15, 80, 80, 80, 80 )
could be one way to draw a circle.

drawOval() could be another way.

"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
I agree. Here's the link:
subject: Need to finish my program, but lost