title: How to get drawStrings on new lines
body: <p>So, I have this <code>String</code>(snippet below) which has a fair amount of information</p>
  
  <pre><code>highscoreString += (i + 1) + ".\t\n" + scores.get(i).getName() + "\t\t\n" + scores.get(i).getScore() + "\n";
  </code></pre>
  
  <p>which is inside this method</p>
  
  <pre><code>public String getHighscoreString() {
      String highscoreString = "";
      int max = 10;
  
      ArrayList&lt;Score&gt; scores;
      scores = getScores();
  
      int i = 0;
      int x = scores.size();
      if (x &gt; max) {
          x = max;
      }
      while (i &lt; x ) {
          highscoreString += (i + 1) + ".\t\n" + scores.get(i).getName() + "\t\t\n" + scores.get(i).getScore() + "\n";
          i++;
      }
      return highscoreString;
  }
  </code></pre>
  
  <p>And what I am trying to do, is put that information in a <code>g.drawString();</code> which I can do easily, but what I cannot do is, to go onto a new line once it gets to the end of that <code>highscoreString</code>(first snippet shown).</p>
  
  <p>This is what I've done so far using the <code>g.drawString()</code> method</p>
  
  <pre><code>g.setFont(new Font("Century Gothic", Font.BOLD, 10));
          g.drawString("" + hsm.getHighscoreString(), 40, 310);
  </code></pre>
  
  <p>Even if I put <code>\n</code> at the end of the <code>highscoreString</code>, it wont end the line...</p>
  
  <p>I'm aware of the fact that I can use this method to make new lines</p>
  
  <pre><code>void drawString(Graphics g, String text, int x, int y) {
  for (String line : text.split("\n"))
      g.drawString(line, x, y += g.getFontMetrics().getHeight());
  }
  </code></pre>
  
  <p>But, how would I be able to split the <code>highscoreString?</code></p>