title: Swing components resizing themselves when out of keyboard focus
body: <p>I am having two problems with the layout of my gui.
  I am using a JTabbedPane to hold two JPanels, each panel has a selection of buttons and text areas, and each is laid out using GridBagLayout.
  In one of my Panels I have a JScrollPane which uses a JTextArea. When I append anything to this text area and then click off the gui so it no longer has focus, or if I change the tab, the sizes of all the text fields and the text are changed to be as small as they can be.</p>
  
  <p>To further illustrate my problem, here are before and after pictures of when i click off the gui after appending to the text area:
  <img src="https://i.stack.imgur.com/oc7se.png" alt="Before I click off the gui"></p>
  
  <p><img src="https://i.stack.imgur.com/GCohH.png" alt="After I click off the gui"></p>
  
  <p>Here is the code that I use to add the JTextArea to the Panel:</p>
  
  <pre><code>table = new JTextArea();
      table.setEditable(false);
      JScrollPane sp = new JScrollPane(table);
      sp.setSize(40, 10);
      c.insets = new Insets(10,10,10,10);
      c.gridx = 1;
      c.gridwidth = 4;
      c.gridy = 7;
      c.gridheight = 7;
      this.add(sp, c);
  </code></pre>
  
  <p>And here is the code I use to add the text Areas to the Panel:</p>
  
  <pre><code>title = new JTextField(10);
      author = new JTextField(10);
      dueDate = new JTextField(10);
      setDate = new JTextField(10);
      setWeighting = new JTextField(10);
  
      c.gridx = 2;
      c.gridy = 1;
      this.add(title, c);//add title field
      c.gridx = 2;
      c.gridy = 2;
      this.add(author, c);//add author field
      c.gridx = 2;
      c.gridy = 3;
      this.add(dueDate, c);//add dueDate field
      c.gridx = 2;
      c.gridy = 4;
      this.add(setDate, c);//add setDate field
      c.gridx = 2;
      c.gridy = 5;
      this.add(setWeighting, c);//add set Weighting field
  </code></pre>