This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Need to finish my program, but lost  RSS feed

 
Stephen Norris
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 9080
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!