title: Why JTextArea is small?
body: <p>I try to make a simple app in SWING: using BorderLayout layout on the JFrame, i put on SOUTH an executing button, on WEST a panel that contains a combobox and on EAST a panel that contains 2 JTextAreas. The problem is, both JTextArea are damn small. Any help and explanation will be welcomed.</p>
  
  <p><strong>This is the code for the panel with the 2 text areas</strong></p>
  
  <pre><code>package cipher;
  
  import java.awt.Dimension;
  import java.awt.GridBagConstraints;
  import java.awt.GridBagLayout;
  
  import javax.swing.BorderFactory;
  import javax.swing.JPanel;
  import javax.swing.JTextArea;
  import javax.swing.border.Border;
  
  class TextPanel extends JPanel {
  
      private JTextArea inputArea, outputArea;
  
      public TextPanel() {
  
          initSize();
          initTextArea();
          initBorder();
          initLayout();
  
          packing();
  
      }
  
      private void packing() {
  
          GridBagConstraints gbc = new GridBagConstraints();
          gbc.gridx = 0;
          gbc.gridy = 0;
          gbc.weightx = 1;
          gbc.weighty = 1;
          add(inputArea,gbc);
          gbc.gridx = 0;
          gbc.gridy = 1;
          gbc.weightx = 1;
          gbc.weighty = 1;
          add(outputArea,gbc);
  
      }
  
      private void initBorder() {
  
          Border outer = BorderFactory.createEmptyBorder(5, 5, 5, 5);
          Border inner = BorderFactory.createTitledBorder("Text");
          setBorder(BorderFactory.createCompoundBorder(outer,inner));
  
      }
  
      private void initLayout() {
  
          setLayout(new GridBagLayout());
  
      }
  
      private void initTextArea() {
  
          inputArea = new JTextArea();
          inputArea.setPreferredSize(new Dimension(385,400));
  
          outputArea = new JTextArea();
          outputArea.setPreferredSize(new Dimension(385,400));
  
      }
  
      private void initSize() {
  
          Dimension size = getPreferredSize();
          size.width = 390;
          setPreferredSize(size);
  
      }
  
  }
  </code></pre>
  
  <p>I've tried using setSize(x,y) but without success. I've tried using JTextArea(rows,columns) but without success. I've used even setPreferredSize with a Dimension but no succeed.</p>
  
  <p><a href="https://i.stack.imgur.com/6wxIi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6wxIi.png" alt="screenshot of results"></a></p>