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.
To further illustrate my problem, here are before and after pictures of when i click off the gui after appending to the text area:


Here is the code that I use to add the JTextArea to the Panel:
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);
And here is the code I use to add the text Areas to the Panel:
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
I was able to partially reproduce your problem like so:
Before and after adding text to JTextArea, it looks like:
And after clicking on tabs:

But it can be fixed by giving the JScrollPane a vertical scrollbar:
Which when run looks like:

Looks good on Mac OS, too: