title: Calculate the display width of a string in Java
body: <p>How to calculate the length (in pixels) of a string in Java?</p>
  
  <p>Preferable without using Swing.</p>
  
  <p>EDIT:
  I would like to draw the string using the drawString() in Java2D 
  and use the length for word wrapping.</p>