title: Why my Swing based GUI application is not responding?
body: <p>I am trying to create my first GUI application using (Java + Eclipse + Swing). This is my code:</p>
  
  <pre><code>import java.awt.*;
  import javax.swing.*;
  
  
  public class HelloWorldSwing extends JFrame {
  
          JTextArea m_resultArea = new JTextArea(6, 30);
  
          //====================================================== constructor
          public HelloWorldSwing() {
              //... Set initial text, scrolling, and border.
              m_resultArea.setText("Enter more text to see scrollbars");
              JScrollPane scrollingArea = new JScrollPane(m_resultArea);
              scrollingArea.setBorder(BorderFactory.createEmptyBorder(10,5,10,5));
  
              // Get the content pane, set layout, add to center
              Container content = this.getContentPane();
              content.setLayout(new BorderLayout());
              content.add(scrollingArea, BorderLayout.CENTER);
              this.pack();
          }
  
          //============================================================= main
          public static void main(String[] args) {
              JFrame win = new HelloWorldSwing();
              win.setTitle("TextAreaDemo");
              win.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              win.setVisible(true);
          }
  
  
  }
  </code></pre>
  
  <p>The code was taken from <a href="http://www.javafaq.nu/java-article743.html" rel="nofollow noreferrer">here</a>.</p>
  
  <p>When I run the application from Eclipse the expected window appears (So, it's good. I see what I want to see). However, when I try to close the window or try to write something in the text area the program freezes. The OS writes me that program is not responding (I try it on Ubuntu).</p>
  
  <p>Can anybody help me to find the reason of the problem?</p>
  
  <p>Thank you in advance for any help.</p>