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
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.
Java Resources at
It is sorta covered in the
JavaRanch Style Guide
subject: How to get the size of a string in pixels?
planning to buy MacBook
getting problem in creating an image from int array
Crop an image in Java
Convert JFrame to image
Size of String in Pixels from JTextField
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2013