A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Other JSE/JEE APIs
How to get the size of a string in pixels?
Joined: Nov 20, 2000
Sep 25, 2002 00:44:00
Is there any way by which i can get the size
in pixels? I mean depending on the
font size and style,i get the length of the string
Author and all-around good cowpoke
Joined: Mar 22, 2000
Sep 25, 2002 20:38:00
Sounds like you are looking for the FontMetrics class in the java.awt package. Thats the class which can tell you such things as the display size of a string in pixels and the other data you need to exactly position text.
I agree. Here's the link:
subject: How to get the size of a string in pixels?
Crop an image in Java
Size of String in Pixels from JTextField
Convert JFrame to image
planning to buy MacBook
getting problem in creating an image from int array
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014