I am relatively new to programming java GUI's and I wanted to use the grid layout and put a container within that grid layout. I am not really sure how to do it but here is what I tried and it didn't work:
Container pane = getContentPane();
pane.setLayout(new GridLayout(3, 1));
Container inp = getContentPane();
inp.setLayout(new GridLayout(2, 4));
Container out = getContentPane();
out.setLayout(new GridLayout(1, 1));
Container bottom = getContentPane();
bottom.setLayout(new GridLayout(1, 2));
pane.add(inp);
pane.add(out);
pane.add(bottom);
inp.add(cn1);
inp.add(cnum1);
inp.add(cn2);
inp.add(cnum2);
inp.add(add);
inp.add(sub);
inp.add(mul);
inp.add(div);
out.add(ans);
bottom.add(clear);
bottom.add(exit);
pane.add(inp);
pane.add(out);
pane.add(bottom);
I know that this is wrong but I hope someone can help me. Thanks!