title: String to BufferedImage with set borders and new line
body: <p>I am new to StackOverflow and need help with following problem.</p>
  <p>background:</p>
  <p>I have to do a project for school where we get a lego mindstorm robot that prints stuff (coordinate based).
  My idea was to implement program in Java that translates (Google translation API) a given input, uses that String to create a BufferedImage and then reads out the coordinates of that image, so the robot can draw/print the translated input.
  I got everything to work except the writing of the text on to the BufferedImage.</p>
  <p>problem:</p>
  <p>I'm looking for a way to create a BufferedImage using a input String. The image should have fixed borders (160x200 px since that is the size of the robots coordinate system). I managed to create a BufferedImage with said borders, but when I insert the String on the image, it just leaves the image, so the back part of the String gets lost.
  Is it possible to create a new line in the BufferedImage automatically, when it reaches the border?</p>
  <p>I am only worrying about the width right now, so its not a problem, if it gets cut off at the bottom (although if you know how to change that you can tell me also).
  Font should be:</p>
  <p><code>Font font = new Font(&quot;Arial&quot;, Font.PLAIN, 25);</code></p>
  <p>because it supports the languages I use.</p>
  <p>Thank you for your help!</p>
  <p>TL;DR: BufferedImage with fixed size and String as content. String shouldn't get cut off: new line, if string reaches the border, without words getting cut off.</p>