11 JFrame frame =
new JFrame();
12 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
13 JPanel panel =
new JPanel();
14 panel.setLayout(
new GridBagLayout());
15 GridBagConstraints c =
new GridBagConstraints();
22 c.anchor = GridBagConstraints.CENTER;
23 c.fill = GridBagConstraints.HORIZONTAL;
24 c.insets =
new Insets(0, 0, 0, 0);
27 JButton button =
new JButton(
"Button 1");
30 button =
new JButton(
"Button 2");
33 button =
new JButton(
"Button 3");
36 button =
new JButton(
"Button 4");
43 button =
new JButton(
"Button 5");
48 c.anchor = GridBagConstraints.SOUTH;
49 c.insets =
new Insets(10, 0, 0, 0);
54 frame.setVisible(
true);