Jenkins
3 years ago
4 changed files with 111 additions and 35 deletions
-
7src/main/java/hauptmenue/GameWindow.java
-
10src/main/java/solitaer/BaseStack.java
-
76src/main/java/solitaer/SolitaerGamePanel.java
-
53src/main/java/solitaer/SolitaerMenue.java
@ -0,0 +1,53 @@ |
|||
package solitaer; |
|||
|
|||
import java.awt.event.ActionEvent; |
|||
import java.awt.event.ActionListener; |
|||
|
|||
import javax.swing.JMenu; |
|||
import javax.swing.JMenuBar; |
|||
import javax.swing.JMenuItem; |
|||
|
|||
public class SolitaerMenue implements ActionListener{ |
|||
|
|||
SolitaerGamePanel solitaerpanel; |
|||
|
|||
JMenuBar menuBar = new JMenuBar(); |
|||
|
|||
JMenu menu = new JMenu("options"); |
|||
|
|||
JMenuItem restart = new JMenuItem("restart"); |
|||
JMenuItem quit = new JMenuItem("quit"); |
|||
|
|||
public SolitaerMenue(SolitaerGamePanel _panel) { |
|||
|
|||
solitaerpanel = _panel; |
|||
|
|||
this.restart.addActionListener(this); |
|||
this.menu.add(restart); |
|||
this.menu.addSeparator(); |
|||
this.quit.addActionListener(this); |
|||
this.menu.add(quit); |
|||
|
|||
this.menuBar.add(menu); |
|||
|
|||
} |
|||
|
|||
public JMenuBar getMenue() { |
|||
return menuBar; |
|||
} |
|||
|
|||
@Override |
|||
public void actionPerformed(ActionEvent e) { |
|||
// TODO Auto-generated method stub |
|||
if(e.getSource() == this.quit) { |
|||
System.out.println("quit"); |
|||
System.exit(0); |
|||
} |
|||
|
|||
if(e.getSource() == this.restart) { |
|||
solitaerpanel.restartGame(); |
|||
} |
|||
|
|||
} |
|||
|
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue