• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

draw string inside a shape

 
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

 
Marshal
Posts: 64642
225
  • 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!