are you able to help me understand why there is no padding in dataInputPanel (the red border one)?
Goal: To have 10 padding on top, right, bottom, left in dataInputPanel
Error: No errors. It's just not working.
Main:
public class Main {
public static void main(String[] args) {
JFrame win = new JFrame();
win.setTitle("Lord of the Rings - Battle Simulator");
win.setSize(500, 600);
win.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
win.setLayout(new GridLayout(2, 1));
win.setResizable(false);
//-------------
JPanel dataInputPanel = new JPanel();
dataInputPanel.setLayout(new GridLayout(1, 2, 10, 0));
//dataInputPanel.setBackground(Color.RED);
dataInputPanel.setBorder(new LineBorder(Color.RED, 4, true));
JPanel battleOutupPanel = new JPanel();
//battleOutupPanel.setBackground(Color.GREEN);
battleOutupPanel.setBorder(new LineBorder(Color.GREEN, 4, true));
//-------------------------------------
int paddingSize = 50;
Insets paddingInsets = new Insets(paddingSize, paddingSize, paddingSize, paddingSize);
// Heroes Data Input Panel - dataInputPanel GridBagLayout 1 row, 2 columns
JPanel heroesDataInputPanel = new JPanel();
//heroesDataInputPanel.setBackground(Color.YELLOW);
heroesDataInputPanel.setBorder(new LineBorder(Color.YELLOW, 4, true));
GridBagConstraints gbc1 = new GridBagConstraints();
gbc1.gridx = 0;
gbc1.gridy = 0;
gbc1.insets = paddingInsets;
dataInputPanel.add(heroesDataInputPanel, gbc1);
// Beasts Data Input Panel - dataInputPanel - GridBagLayout 1 row, 2 columns
JPanel beastsDataInputPanel = new JPanel();
//beastsDataInputPanel.setBackground(Color.ORANGE);
beastsDataInputPanel.setBorder(new LineBorder(Color.ORANGE, 4, true));
GridBagConstraints gbc2 = new GridBagConstraints();
gbc2.gridx = 1;
gbc2.gridy = 0;
gbc2.insets = paddingInsets;
dataInputPanel.add(beastsDataInputPanel, gbc2);
//-------------
win.add(dataInputPanel);
win.add(battleOutupPanel);
win.setVisible(true);
}
}
Win:
public class Win extends JFrame {
}
Pnl:
public class Pnl extends JPanel {
}
Thank you!

You really need to have a look at How to use borders - and focus in
CompoundBorder