Forums Register Login

Centering Text on image

+Pie Number of slices to send: Send
Hi,
I am using com.mullassery.imaging.Imaging package in my java program.I am overlaying a text on the image.But what i need is to center the text when overlaying.It can span to any number of lines so the problem is i cant specify the x and y co-ordinates.Does anybody know if there is any existing functionality to center the text.Please help.
+Pie Number of slices to send: Send
Never heard of it.
Using the J2SE packages, I've used Graphics to get the size of an image, then the FontMetrics class to determine the size of the string. Subtract the string size from the size of the image and divide by two. Of course, doing multiple lines requires some more calculations, but the information is all there in those two classes.
Anderson gave himself the promotion. So I gave myself this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 552 times.
Similar Threads
Centering the header of the columns in JTable
How do I Center Align text using drawString?
Ordered List tag inside jsp
How to center a String within a JPEG?
Tomcat error??
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 19, 2024 01:10:28.