Advertisement
Guest User

Untitled

a guest
May 21st, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. package GUI;
  2. import java.awt.BorderLayout;
  3. import java.awt.Dimension;
  4. import java.awt.FlowLayout;
  5. import java.awt.GridLayout;
  6. import java.awt.event.ActionEvent;
  7. import java.awt.event.ActionListener;
  8.  
  9. import javax.swing.JButton;
  10. import javax.swing.JFrame;
  11. import javax.swing.JPanel;
  12.  
  13. import minesweeper.Spiel;
  14.  
  15.  
  16. public class MineFrame extends JFrame implements ActionListener
  17. {
  18.  
  19. public MineFrame()
  20. {
  21. JPanel gridLayout = new JPanel(new GridLayout(1, 2));
  22. JPanel flowLayout = new JPanel(new FlowLayout(FlowLayout.RIGHT));
  23.  
  24. JButton restart = new JButton("Neustart");
  25. JButton close = new JButton("Beenden");
  26. setTitle("Minesweeper");
  27. setSize(600,800);
  28. setMinimumSize(new Dimension(600,800));
  29.  
  30. //Menue menue = new Menue();
  31. //add(menue);
  32.  
  33. // BorderLayout hauptFenster = new BorderLayout();
  34. // this.setLayout(new BorderLayout());
  35.  
  36. //Verschachteltes Layout für Buttons
  37. add(BorderLayout.SOUTH, flowLayout);
  38.  
  39. flowLayout.add(gridLayout);
  40. gridLayout.add(restart);
  41. gridLayout.add(close);
  42.  
  43.  
  44. MinePanel minePanel = new MinePanel(new Spiel());
  45. add(minePanel);
  46.  
  47. restart.addActionListener(minePanel);
  48. close.addActionListener(this);
  49.  
  50. setVisible(true);
  51. setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  52. }
  53.  
  54. public static void main(String[] args) {
  55. new MineFrame();
  56. }
  57.  
  58. @Override
  59. public void actionPerformed(ActionEvent event) {
  60.  
  61. System.exit(0);
  62. }
  63.  
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement