'What layout should I use for my JPanels to look like this?
I would like to layout some JPanel containers to look something like this:

However, I am not quite sure what layout would be the best to choose, since I am still new to using the layout manager and do not want to only ever use null as layout manager.
So I thought that I could maybe split this into two panels. One for the left side and one for the right panels. My frame is 600x600px big and has the BorderLayout, so I thought I maybe can do something like this, which did not work:
JPanel right = new JPanel();
right.setLayout(new Border Layout());
right.setSize(400, 600);
JPanel green = new JPanel();
green.setPreferredSize(new Dimension(200,200));
green.setBackground(Color.green);
right.add(green, BorderLayout.PAGE_START);
//for orange same code but with center and for pink the same but with page_end
frame.add(left, BorderLayout.LINE_START);
frame.add(right, BorderLayout.LINE_END);
...
Solution 1:[1]
I would suggest using a gridbag layout where you can have components take up multiple cells. You can find more information using this java doc: https://docs.oracle.com/javase/7/docs/api/java/awt/GridBagLayout.html
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | 49KWIC |
