title: How to update swing UI while ActionListener is in progress
body: <p>In my code below I want the TextArea to be cleared while the application is loading data. I also added a repaint() but still it's not  cleared. 
  Do I have to notify it differently to force a repaint?</p>
  
  <pre><code>    button.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent event) {
              textArea.setText("");
              textArea.repaint();
  
  
              String result = //call a REST API
              textArea.setText(result);
          }
      });
  </code></pre>