Jump to content
We've recently updated our Privacy Statement, available here ×

width of a String in pixel


akhanh

Recommended Posts

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

You can use the java.awt.FontMetrics class and its methods. You create a FontMetrics instance by passing in a Font object and then you can use it to do calls like myFontMetrics.stringWidth("Some string");

 

Hope this helps, I think this is what you were asking but I am not totally sure.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...