Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

draw string inside a shape

 
Nathalie Monvoisin
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi, i have this piece of code, i want to insert a text inside my shape. can anyone tell me how to proceed. thank you

 
Campbell Ritchie
Marshal
Posts: 52630
119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you have a reference to the objects representing those Shapes, you can find the bounding rectangles for them all and find their coordinates easily. At the simplest you can use the drawString method of Graphics.
Ellipse2D is a rectangle; if you don't believe me look at its API documentation. It will have methods to find its coordinates.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!