/*
* GridBag2a.java
*/
//package layout;
import java.awt.*;
import javax.swing.*;
public class GridBag2a extends JFrame {
public GridBag2a() {
GridBagConstraints gridBagConstraints;
panel = new JPanel();
label = new JLabel();
bt1 = new JButton();
bt2 = new JButton();
bt3 = new JButton();
bt4 = new JButton();
bt5 = new JButton();
bt6 = new JButton();
bt7 = new JButton();
bt8 = new JButton();
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
panel.setLayout(new GridBagLayout());
label.setBackground(new Color(255, 0, 0));
label.setFont(new Font("Tahoma", 0, 18));
label.setText(" Umgebung nicht gesetzt! ");
label.setOpaque(true);
gridBagConstraints = new GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 0;
gridBagConstraints.gridwidth = 2;
gridBagConstraints.gridheight = 2;
gridBagConstraints.fill = GridBagConstraints.BOTH;
gridBagConstraints.insets = new Insets(0, 0, 0, 4);
panel.add(label, gridBagConstraints);
bt1.setText("bt1");
gridBagConstraints = new GridBagConstraints();
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 0;
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints.insets = new Insets(0, 0, 2, 4);
panel.add(bt1, gridBagConstraints);
bt2.setText("bt2");
gridBagConstraints = new GridBagConstraints();
gridBagConstraints.gridx = 3;
gridBagConstraints.gridy = 0;
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints.insets = new Insets(0, 0, 2, 4);
panel.add(bt2, gridBagConstraints);
bt3.setText("bt3");
gridBagConstraints = new GridBagConstraints();
gridBagConstraints.gridx = 4;
gridBagConstraints.gridy = 0;
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints.insets = new Insets(0, 0, 2, 4);
panel.add(bt3, gridBagConstraints);
bt4.setText("bt4");
gridBagConstraints = new GridBagConstraints();
gridBagConstraints.gridx = 5;
gridBagConstraints.gridy = 0;
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints.insets = new Insets(0, 0, 2, 4);
panel.add(bt4, gridBagConstraints);
bt5.setText("bt5");
gridBagConstraints = new GridBagConstraints();
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 1;
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints.insets = new Insets(2, 0, 0, 4);
panel.add(bt5, gridBagConstraints);
bt6.setText("bt6");
gridBagConstraints = new GridBagConstraints();
gridBagConstraints.gridx = 3;
gridBagConstraints.gridy = 1;
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints.insets = new Insets(2, 0, 0, 4);
panel.add(bt6, gridBagConstraints);
bt7.setText("bt7");
gridBagConstraints = new GridBagConstraints();
gridBagConstraints.gridx = 4;
gridBagConstraints.gridy = 1;
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints.insets = new Insets(2, 0, 0, 4);
panel.add(bt7, gridBagConstraints);
bt8.setText("bt8");
gridBagConstraints = new GridBagConstraints();
gridBagConstraints.gridx = 5;
gridBagConstraints.gridy = 1;
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints.insets = new Insets(2, 0, 0, 4);
panel.add(bt8, gridBagConstraints);
getContentPane().add(panel, BorderLayout.CENTER);
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
setBounds((screenSize.width-607)/2, (screenSize.height-118)/2, 607, 118);
}
public static void main(String args[]) {
new GridBag2a().setVisible(true);
}
private JButton bt1, bt2, bt3, bt4, bt5, bt6, bt7, bt8;
private JLabel label;
private JPanel panel;
}