title: Access GUI components from another class
body: <p>I'm new to Java and I've hit a brick wall. I want to access GUI components (that have been created in one class) from another class. I am creating a new GUI class from one class, like so;</p>
  
  <pre><code>GUI gui = new GUI();
  </code></pre>
  
  <p>and I can access the components in that class, but when I go to a different class I cant. I really just need to access the <code>JTextAreas</code> to update their content. Could someone point me in the right direction please, any help is greatly appreciated. </p>
  
  <p><code>GUI</code> Class:</p>
  
  <pre><code>public class GUI {
  
      JFrame frame = new JFrame("Server");        
      ...
      JTextArea textAreaClients = new JTextArea(20, 1);  
      JTextArea textAreaEvents = new JTextArea(8, 1);
  
      public GUI()
      {
          frame.setLayout(new FlowLayout(FlowLayout.LEADING, 5, 3));     
          ...
          frame.setVisible(true);
      }
  }
  </code></pre>