title: Issue with JScrollPane, JTextArea & JPanel
body: <p>I need to add a vertical scroll bar to my JPanel. The issue arises when the long string of text doesn't wrap properly etc. So I followed steps online and put it in a text area and it worked fine (without scrollpane). </p>
  
  <p>However upon adding the JScrollpane (which should only be vertical, and please assume that it is required i.e. can't set a minimum dimension) to the JPanel, when I resize it horizontally, it messes up completely. It doesn't wrap as it should upon resizing and the other components' positions mess up.</p>
  
  <p>It may seem weird, that I have unnecessary panels here, however I'm working as part of a larger program and the are required (the for loop is just for testing purposes).</p>
  
  <p>So to summarise: upon horizontal resizing the window, it doesn't behave as expected.</p>
  
  <p>Would appreciate some guidance.</p>
  
  <pre><code>import java.awt.BorderLayout;
  import java.awt.GridLayout;
  
  import javax.swing.BoxLayout;
  import javax.swing.JButton;
  import javax.swing.JFrame;
  import javax.swing.JLabel;
  import javax.swing.JPanel;
  import javax.swing.JScrollPane;
  import javax.swing.JTextArea;
  import javax.swing.ScrollPaneConstants;
  
  public class Main {
  
      public static void main(String[] args) {
  
          String s = "Hello my name is test. I am a test. Hello my name is test. I am a test. Hello my name is test. I am a test. Hello my name is test. I am a test. ";
          JFrame jf = new JFrame("Test");
          jf.setSize(600, 200);
  
          JPanel big = new JPanel();
          big.setLayout(new BoxLayout(big, BoxLayout.Y_AXIS));
  
          for (int i = 0; i &lt; 2; i++) {
              JPanel first = new JPanel(new BorderLayout());
  
              JPanel insideTop = new JPanel(new GridLayout(2, 2));
              insideTop.add(new JLabel("test"));
              insideTop.add(new JLabel("test"));
              insideTop.add(new JLabel("test"));
              insideTop.add(new JLabel("test"));
  
              JPanel insideMiddle = new JPanel(new BorderLayout());
              insideMiddle.add(new JLabel("Description"), BorderLayout.NORTH);
              JTextArea jta = new JTextArea(s);
              jta.setWrapStyleWord(true);
              jta.setLineWrap(true);
              jta.setEditable(false);
              jta.setFocusable(false);
              jta.setOpaque(false);
              insideMiddle.add(jta, BorderLayout.CENTER);
  
              JPanel insideBottom = new JPanel(new BorderLayout());
              insideBottom.add(new JLabel("Bottom left"), BorderLayout.WEST);
              insideBottom.add(new JButton("Bottom right"), BorderLayout.EAST);
  
              first.add(insideTop, BorderLayout.NORTH);
              first.add(insideMiddle, BorderLayout.CENTER);
              first.add(insideBottom, BorderLayout.SOUTH);
              big.add(first);
          }
  
          JScrollPane scrollPane = new JScrollPane(big, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
                  ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
  
          jf.add(scrollPane);
          jf.setVisible(true);
  
      }
  }
  </code></pre>