Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package GUI;
- import java.awt.BorderLayout;
- import java.awt.Dimension;
- import java.awt.FlowLayout;
- import java.awt.GridLayout;
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import javax.swing.JButton;
- import javax.swing.JFrame;
- import javax.swing.JPanel;
- import minesweeper.Spiel;
- public class MineFrame extends JFrame implements ActionListener
- {
- public MineFrame()
- {
- JPanel gridLayout = new JPanel(new GridLayout(1, 2));
- JPanel flowLayout = new JPanel(new FlowLayout(FlowLayout.RIGHT));
- JButton restart = new JButton("Neustart");
- JButton close = new JButton("Beenden");
- setTitle("Minesweeper");
- setSize(600,800);
- setMinimumSize(new Dimension(600,800));
- //Menue menue = new Menue();
- //add(menue);
- // BorderLayout hauptFenster = new BorderLayout();
- // this.setLayout(new BorderLayout());
- //Verschachteltes Layout für Buttons
- add(BorderLayout.SOUTH, flowLayout);
- flowLayout.add(gridLayout);
- gridLayout.add(restart);
- gridLayout.add(close);
- MinePanel minePanel = new MinePanel(new Spiel());
- add(minePanel);
- restart.addActionListener(minePanel);
- close.addActionListener(this);
- setVisible(true);
- setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- }
- public static void main(String[] args) {
- new MineFrame();
- }
- @Override
- public void actionPerformed(ActionEvent event) {
- System.exit(0);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement