title: Java AWT Component and Panel Padding/Border
body: <p>I have no idea why I can't find a solution for this...  I am trying to layout some AWT components in a flow layout.  The only problem is the 'padding' between the components (Panels) when using a flow layout.  This is what the applet currently looks like:  <a href="http://i.stack.imgur.com/2KZgD.png" rel="nofollow">http://i.stack.imgur.com/2KZgD.png</a></p>
  
  <p>I need a way to set the Applet/Panels so that the two panels (black boxes) are touching (no 'padding').  The entire program is Swing free, all AWT, and I plan on keeping it that way.  I feel this is a very simple solution, but I have not been able to find an answer.</p>
  
  <p>This is the init() code from the applet class:</p>
  
  <pre><code>public void init() {
    setLayout(new FlowLayout());
    c1 = new TestPanel();
    c2 = new TestPanel();
    c1.setPreferredSize(new Dimension(640, 480));
    c2.setPreferredSize(new Dimension(100, 480));
    add(c1);
    add(c2);
  }
  </code></pre>
  
  <p>This is the TestPanel class I'm using:</p>
  
  <pre><code>public class TestPanel extends Panel {
    public void paint(Graphics g) {
      g.setColor(Color.BLACK);
      g.fillRect(0, 0, this.getPreferredSize().width, this.getPreferredSize().height);
    }
  }
  </code></pre>