title: java-update text in a JTextArea before the method is running
body: <p>I have two classes, GUI and Test.</p>
  
  <p>In GUI, it has a <code>JTextArea</code> and a button. When the button is click, the method <code>running()</code> in Text is called. listener of the button is as follows:</p>
  
  <pre><code>public void actionPerformed(ActionEvent event){
  
    if (event.getSource() == start)  //start is the button
    {
         textArea.setText(" Testing starts!");
         pane.updateUI();
         new Text().running(this);
    }
  }
  </code></pre>
  
  <p>And the running() in class Text as follows:</p>
  
  <pre><code>public void running(GUI gui) {
      gui.textArea.setText("clientIP IS:"+clientIP);
  gui.pane.updateUI();
      .......
  }
  </code></pre>
  
  <p>When I click the start button in GUI, the running method in class Test is performed. However, the text in the textArea is updated after method running() is finished. </p>
  
  <p>How can I update the text before the method is called?</p>
  
  <p>Thanks very much!</p>