I have a set of
JTextArea = new JTextArea(5, 40);
In the parent container of the JTextArea (denoted as Panel 1 in your drawing), call the function:
For reference, see this documentation page:
As you only have a single child in panel1, the BorderLayout layout manager of panel1 will by default stretch the text area to use all available space in the parent container.
You may want to take away the constructor parameters specifying the size of your TextArea. The BorderLayout should take care of sizes for you :)
You can request that Swing respects a certain minimum size for the text area by calling:
textArea.setMinimumSize(new Dimension(minimum_width, minimum_height));