I'm using eclipse and windowsbuilder, for making java gui application. I'm having a trouble in maintaining the padding of the components in swing panel. I'm using the group layout in the windowbuilder designer to position components. But sadly I'm not able to maintain the the padding when the window gets re-sized.

1.jpg
Normal window

2.jpg
window when re-sized or maximized

When the window is re-sized, I wish to make my app automatically re-size the horizontal and vertical gaps like in the third image so that component padding will be maintained correctly.
vRtkR.jpg
The code:

public myframe() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 450, 300);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
contentPane.setLayout(new BorderLayout(0, 0));
setContentPane(contentPane);

JPanel panel = new JPanel();
contentPane.add(panel, BorderLayout.CENTER);

JButton btnNewButton = new JButton("New button");
GroupLayout gl_panel = new GroupLayout(panel);
gl_panel.setHorizontalGroup(
gl_panel.createParallelGroup(Alignment.TRAILING)
.addGroup(Alignment.LEADING, gl_panel.createSequentialGroup()
.addGap(166)
.addComponent(btnNewButton)
.addContainerGap(169, Short.MAX_VALUE))
);
gl_panel.setVerticalGroup(
gl_panel.createParallelGroup(Alignment.LEADING)
.addGroup(gl_panel.createSequentialGroup()
.addGap(37)
.addComponent(btnNewButton)
.addContainerGap(192, Short.MAX_VALUE))
);
panel.setLayout(gl_panel);
}