diff --git a/src/main/java/hauptmenue/GameWindow.java b/src/main/java/hauptmenue/GameWindow.java index 7fe612d..9230044 100644 --- a/src/main/java/hauptmenue/GameWindow.java +++ b/src/main/java/hauptmenue/GameWindow.java @@ -12,7 +12,7 @@ public class GameWindow extends JFrame { private static final long serialVersionUID = 1L; private final SolitaerGamePanel gamePanel = new SolitaerGamePanel(); - private SolitaerMenue smenue = new SolitaerMenue(); + private SolitaerMenue smenue = new SolitaerMenue(gamePanel); public GameWindow() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); diff --git a/src/main/java/solitaer/SolitaerMenue.java b/src/main/java/solitaer/SolitaerMenue.java index 76a86ef..e3dbcb8 100644 --- a/src/main/java/solitaer/SolitaerMenue.java +++ b/src/main/java/solitaer/SolitaerMenue.java @@ -9,6 +9,8 @@ import javax.swing.JMenuItem; public class SolitaerMenue implements ActionListener{ + SolitaerGamePanel solitaerpanel; + JMenuBar menuBar = new JMenuBar(); JMenu menu = new JMenu("options"); @@ -16,7 +18,9 @@ public class SolitaerMenue implements ActionListener{ JMenuItem restart = new JMenuItem("restart"); JMenuItem quit = new JMenuItem("quit"); - public SolitaerMenue() { + public SolitaerMenue(SolitaerGamePanel _panel) { + + solitaerpanel = _panel; this.restart.addActionListener(this); this.menu.add(restart); @@ -41,6 +45,10 @@ public class SolitaerMenue implements ActionListener{ System.exit(0); } + if(e.getSource() == this.restart) { + solitaerpanel.restartGame(); + } + } }