import javax.swing.*;
import java.awt.*;
public class OurGUI extends JFrame
{
private JButton button1;
private JButton button2;
private JButton button3;
private JButton button4;
private JButton button5;
private JPanel panelButton;
private JLabel oben;
private JLabel label;
private JPanel bild;
private ImageIcon icon;
public OurGUI()
{
super();
setTitle ("Willie-Wurm");
setSize(600,700);
setLocation(300,0);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLayout(new BorderLayout(5,5));
//Buttons erzeugen
button1 = new JButton("Spielen");
button2 = new JButton("Spielregeln");
button3 = new JButton("Highscore");
button4 = new JButton("Einstellungen");
button5 = new JButton("About");
//Panels erzeugen
GridLayout gl = new GridLayout(5,1) ;
gl.setHgap(100);
panelButton = new JPanel(gl);
JPanel bild = new JPanel ();
//Bild importieren
ImageIcon icon = new ImageIcon("Willie-Wurm.jpg");
//Buttons auf Panel
panelButton.add(button1);
panelButton.add(button2);
panelButton.add(button3);
panelButton.add(button4);
panelButton.add(button5);
//Labels erzeugen
oben = new JLabel("Willie-Wurm");
JLabel label = new JLabel( icon, JLabel.CENTER);
//Label zentrieren
oben.setHorizontalAlignment(JLabel.CENTER);
bild.add(label);
//Labels auf Frame
getContentPane().add(BorderLayout.NORTH, oben);
//Panels auf Frame
getContentPane().add(BorderLayout.WEST, panelButton);
getContentPane().add(BorderLayout.EAST, bild);
setVisible(true);
}
}