title: Printing a 2d char array to a Swing Gui (Java)
body: <p>I am currently trying to convert a Java application (also made by me) from a console based one to one that uses a Swing based GUI. All well and good, but I don't understand Swing as well as I'd like to, so this is somewhat difficult. </p>
  
  <p>My current issue is printing an array of chars to the output. Originally, I was able to print to the console directly through judicious use of for loops and System.out.print(theworld[j][i]); (where i and j iterate through the loops, and theworld is the array in question), but I don't know how to get something similar to work for a Swing GUI.</p>
  
  <p>Specifically, it was printed to the console like this:</p>
  
  <pre><code>for (int i = 0; i &lt; ydimension; i++){
    for (int j = 0; j &lt; xdimension; j++){
      System.out.print(theworld [j][i]);
    }
  System.out.println();
  }
  </code></pre>
  
  <p>Currently, I have a JFrame with a JMenuBar attached, which all works as intended. What I'd like is that the array appears printed on the frame (or on an attached panel) in response to a stimulus, either a button press or a timer tick. </p>
  
  <p>Another thing is, the array will be getting updated every tick, and this should be reflected in the final printed array, so would I go about clearing the screen before printing the array or something similar?</p>
  
  <p>Thanks.</p>
  
  <p>EDIT: Just having looked at my code again, I've realised in the question I omitted the println in the outer for loop. It's supposed to print line by line, rather than all as one line. The above code has been corrected to reflect this. </p>