title: How do i render wrapped text on an image in java
body: <p>Using Java, is there any built-in way to render text so that its limited to a rectangle on a <code>graphics2D</code> object?</p>
  
  <p>I know I can use <code>Graphics2D.drawString</code> but it only draws a sinlge line of text.</p>
  
  <p>I also know that I can use </p>
  
  <pre><code>FontMetrics fm= graphics.getFontMetrics(font);
  Rectangle2D rect=fm.getStringBounds("Some Text",graphics);
  </code></pre>
  
  <p>to get the information about the bounds of a string when rendered using some <code>Font font</code> on some <code>Graphics2D graphics</code> object. </p>
  
  <p>So I could start looping, breaking my string and so on to force it to fit inside some rectangle. </p>
  
  <p>But I would much prefer not to have to write those...</p>
  
  <p>Is there any ready made function that will do this for me?</p>