title: How do I make a JTextArea fill up a JPanel completely?
body: <p>I'd like my JTextArea component to completely fill up my JPanel. As you can see here, there is some padding around the JTextArea (which is colored red with an etched border) in this picture:</p>
  
  <p><img src="https://i.stack.imgur.com/ydzES.png" alt="Image of program below."></p>
  
  <pre><code>import java.awt.*;
  import javax.swing.*;
  import javax.swing.border.*;
  
  public class Example
  {
      public static void main(String[] args)
      {
      // Create JComponents and add them to containers.
      JFrame frame = new JFrame();
      JPanel panel = new JPanel();
      JTextArea jta = new JTextArea("Hello world!");
      panel.add(jta);
      frame.setLayout(new FlowLayout());
      frame.add(panel);
  
      // Modify some properties.
      jta.setRows(10);
      jta.setColumns(10);
      jta.setBackground(Color.RED);
      panel.setBorder(new EtchedBorder());
  
      // Display the Swing application.
      frame.setSize(200, 200);
      frame.setVisible(true);
      }
  }
  </code></pre>