title: Java - Redirecting system.out.println to a JLabel
body: <p>I want to redirect a sytem.out.println to a JLabel in another class.</p>
  
  <p>I have 2 classes, NextPage and Mctrainer.</p>
  
  <p>NextPage is basically just a Jframe (The gui for my project), and I have created a Jlabel in Nextpage using this code;</p>
  
  <pre><code>public class NextPage extends JFrame {
  
      JLabel label1; 
  
      NextPage() {
          label1 = new JLabel();
          label1.setText("welcome");
          getContentPane().add(label1);
  </code></pre>
  
  <p>This is the code for Mctrainer:</p>
  
  <pre><code>public class Mctrainer {
  
      JLabel label1;
  
      Mctrainer() {
          HttpClient client2 = new DefaultHttpClient();
          HttpPost post = new HttpPost("http://oo.hive.no/vlnch");
          HttpProtocolParams.setUserAgent(client2.getParams(),"android");
          try {
              List &lt;NameValuePair&gt; nvp = new ArrayList &lt;NameValuePair&gt;();
              nvp.add(new BasicNameValuePair("username", "test"));
              nvp.add(new BasicNameValuePair("password", "test"));
              nvp.add(new BasicNameValuePair("request", "login"));
              nvp.add(new BasicNameValuePair("request", "mctrainer"));
              post.setEntity(new UrlEncodedFormEntity(nvp));
  
              HttpContext httpContext = new BasicHttpContext();
  
              HttpResponse response1 = client2.execute(post, httpContext);
              BufferedReader rd = new BufferedReader(new InputStreamReader(response1.getEntity().getContent()));
              String line = "";
              while ((line = rd.readLine()) != null) {
                  System.out.println(line);
              } 
          } 
          catch (IOException e) {
              e.printStackTrace();
          }
      }
  </code></pre>
  
  <p>Mctrainer basically just prints out JSON data from a server using system.out.println. 
  I want to redirect it to show up in the JLabel in my GUI (NextPage) instead of console.
  Any suggestions on how to do this?</p>