I'm trying to build a simple AWT application in Java. I want all of the containers in the main window to be separated by bit. I can accomplish this by setting the Hgap and Vgap in the BorderLayout constructor (see below.)
However, I can't figure out how to put a cap between the containers and the edges of the main window. How do I add a few pixels of padding to the main window?
import java.awt.*;
import java.applet.Applet;
public class LayoutTest extends Applet {
public void init() {
BorderLayout layout = new BorderLayout(8, 8);
setLayout(layout);
add(new Button("Left"), BorderLayout.CENTER);
add(new Button("Right"), BorderLayout.EAST);
}
}