Browse Source

Add SolitaerMenue

feature_solitaer_MenueBar
Alexander Hartung 3 years ago
parent
commit
b8ad7aca06
  1. 7
      src/main/java/hauptmenue/GameWindow.java
  2. 30
      src/main/java/solitaer/SolitaerMenue.java

7
src/main/java/hauptmenue/GameWindow.java

@ -5,18 +5,19 @@ import java.awt.Dimension;
import javax.swing.JFrame; import javax.swing.JFrame;
import solitaer.SolitaerGamePanel; import solitaer.SolitaerGamePanel;
import solitaer.SolitaerMenue;
public class GameWindow extends JFrame { public class GameWindow extends JFrame {
/**
*
*/
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private final SolitaerGamePanel gamePanel = new SolitaerGamePanel(); private final SolitaerGamePanel gamePanel = new SolitaerGamePanel();
private SolitaerMenue smenue = new SolitaerMenue();
public GameWindow() { public GameWindow() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
gamePanel.setPreferredSize(new Dimension(1180, 780)); gamePanel.setPreferredSize(new Dimension(1180, 780));
this.setJMenuBar(smenue.getMenue());
add(gamePanel); add(gamePanel);
pack(); pack();

30
src/main/java/solitaer/SolitaerMenue.java

@ -0,0 +1,30 @@
package solitaer;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
public class SolitaerMenue {
JMenuBar menuBar = new JMenuBar();
JMenu menu = new JMenu("options");
JMenuItem restart = new JMenuItem("restart");
JMenuItem quit = new JMenuItem("quit");
public SolitaerMenue() {
this.menu.add(restart);
this.menu.addSeparator();
this.menu.add(quit);
this.menuBar.add(menu);
}
public JMenuBar getMenue() {
return menuBar;
}
}
Loading…
Cancel
Save