Your gui split[
^]
You can see that there is a panel beneath those 3 red panels.
EDIT: Think about the coding. Separate GUI and Control, set up a service layer.
You're probably writing a description first (big hint!).
EDIT2:
PLease take a look here:
A Visual Guide to Layout Managers[
^]
and you might try this simple
JFrame
. Please create yourself a playground project and try things out there:
import java.awt.Color;
import java.awt.GridLayout;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class MyFrame extends JFrame {
private JPanel panelLeft = new JPanel();
private JPanel panelRight = new JPanel();
private JPanel panelLeftTop = new JPanel();
private JPanel panelLeftBottom = new JPanel();
public MyFrame(){
this.ignition();
}
private void ignition() {
this.setSize(800,600);
this.setLayout(new GridLayout(1, 2));
panelLeft.setBackground(Color.RED);
panelRight.setBackground(Color.GREEN);
panelLeftTop.setBackground(Color.YELLOW);
panelLeftBottom.setBackground(Color.BLUE);
panelLeftTop.setSize(400,300);
panelLeftBottom.setSize(400,300);
panelLeft.setLayout(new GridLayout(2,1));
panelLeft.add(panelLeftTop);
panelLeft.add(panelLeftBottom);
this.add(panelLeft);
this.add(panelRight);
}
public static void main(String[] args) {
new MyFrame().setVisible(true);
}
}