I am creating a Frame with a checkerboard. Currently the checkerboard and the two other panels fill the entire form, but I would like to have a 20 pixel border of blank space around the three frames, but I can only change the spacing between frames. How do I do this?
My class extends Frame and the important constructor lines are below (I've left out the TextArea constructors & the panel.add's). I've attached a sketch of what I would like it to look like.
[code=java]
Panel pnlCheckerboard = new Panel();
TextArea txtSquare[] = new TextArea[16];
//
Panel pnlInput = new Panel();
TextField txtStart = new TextField(8);
TextField txtStop = new TextField(8);
TextField txtStep = new TextField(8);
Label lblStart = new Label("Start");
Label lblStop = new Label("Stop");
Label lblStep = new Label("Skip");
//
Panel pnlButtons = new Panel();
Button btnGo = new Button("Go");
Button btnClear = new Button("Clear") ;
//
this.setLayout( new BorderLayout(10 ,10));
pnlCheckerboard .setLayout(new GridLayout(4,4, 10,10));
pnlInput.setLay out(new GridLayout(2,3, 10,10));
pnlButtons.setL ayout(new FlowLayout(Flow Layout.CENTER,5 0,1));
// Bunches of add's left out
this.add(pnlChe ckerboard, NORTH);
this.add(pnlInp ut, CENTER);
this.add(pnlBut tons, SOUTH);
[/code]
My class extends Frame and the important constructor lines are below (I've left out the TextArea constructors & the panel.add's). I've attached a sketch of what I would like it to look like.
[code=java]
Panel pnlCheckerboard = new Panel();
TextArea txtSquare[] = new TextArea[16];
//
Panel pnlInput = new Panel();
TextField txtStart = new TextField(8);
TextField txtStop = new TextField(8);
TextField txtStep = new TextField(8);
Label lblStart = new Label("Start");
Label lblStop = new Label("Stop");
Label lblStep = new Label("Skip");
//
Panel pnlButtons = new Panel();
Button btnGo = new Button("Go");
Button btnClear = new Button("Clear") ;
//
this.setLayout( new BorderLayout(10 ,10));
pnlCheckerboard .setLayout(new GridLayout(4,4, 10,10));
pnlInput.setLay out(new GridLayout(2,3, 10,10));
pnlButtons.setL ayout(new FlowLayout(Flow Layout.CENTER,5 0,1));
// Bunches of add's left out
this.add(pnlChe ckerboard, NORTH);
this.add(pnlInp ut, CENTER);
this.add(pnlBut tons, SOUTH);
[/code]
Comment