I have two JScrollPanes in the same window. The one on the left is large enough to display the contents of the contained panel. The one on the right is not large enough to display its contents and thus it needs to create a vertical scrollbar.

But as you can see, the problem is that when the vertical scrollbar appears, the scrollbar appears on the inside of the JScrollPane. It covers up content contained inside and thus a horizontal scrollbar is necessary to show everything. I want that fixed.
I realize that I can turn the vertical scrollbar on all the time, but for aesthetic reasons, I only want for it to appear when necessary, without making it necessary for a horizontal scrollpane to appear.
EDIT: My code for starting this is as simple as can be:
JScrollPane groupPanelScroller = new JScrollPane(groupPanel);
this.add(groupPanelScroller, "align center");
I am using MigLayout (MigLayout.com), but this problem seems to appear no matter what layout manager I am using. Also, if I shrink the window so that the left panel is no longer large enough to display everything, the same behavior as the right panel occurs.