Browse Source

Merge commit '8bbad65768b6c487421bcc043329efd6eb29c844' into HEAD

develop
Jenkins 3 years ago
parent
commit
1c8ba1e1c1
  1. 2
      src/main/java/TicTacToe/TicTacToeGame.java
  2. 86
      src/main/java/hauptmenue/GameWindow.java

2
src/main/java/TicTacToe/TicTacToeGame.java

@ -13,7 +13,7 @@ import javax.swing.JPanel;
public class TicTacToeGame extends JPanel {
private static final long serialVersionUID = 1L;
private static final int width = 600, height = 600;
public static final int width = 600, height = 600;
private static final int maxPlayers = 3;
private static final int playFieldSize = 9;

86
src/main/java/hauptmenue/GameWindow.java

@ -1,28 +1,100 @@
package hauptmenue;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.JButton;
import javax.swing.JFrame;
import Minesweeper.MinesweeperGame;
import TicTacToe.TicTacToeGame;
import solitaer.SolitaerGamePanel;
import solitaer.SolitaerMenue;
public class GameWindow extends JFrame {
private static final long serialVersionUID = 1L;
private final SolitaerGamePanel gamePanel = new SolitaerGamePanel();
private SolitaerMenue smenue = new SolitaerMenue(gamePanel);
public GameWindow() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
gamePanel.setPreferredSize(new Dimension(1180, 780));
this.setJMenuBar(smenue.getMenue());
setSize(new Dimension(200, 125));
setLayout(null);
JButton soli = new JButton("Solitaer");
JButton Tic = new JButton("TicTacToe");
JButton Mine = new JButton("Minesweeper");
soli.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
soli.setVisible(false);
Tic.setVisible(false);
Mine.setVisible(false);
initSoli();
}
});
Tic.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
soli.setVisible(false);
Tic.setVisible(false);
Mine.setVisible(false);
initTicTacToe();
}
});
Mine.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
soli.setVisible(false);
Tic.setVisible(false);
Mine.setVisible(false);
initMinesweeper();
}
add(gamePanel);
pack();
});
soli.setBounds(0, 0, 200, 30);
Tic.setBounds(0, 30, 200, 30);
Mine.setBounds(0, 60, 200, 30);
add(soli);
add(Tic);
add(Mine);
setVisible(true);
}
private void initSoli() {
SolitaerGamePanel gamePanel = new SolitaerGamePanel();
SolitaerMenue smenue = new SolitaerMenue(gamePanel);
gamePanel.setVisible(true);
gamePanel.setSize(new Dimension(1180, 780));
setSize(new Dimension(1180, 780));
//gamePanel.setPreferredSize(new Dimension(1180, 780));
setJMenuBar(smenue.getMenue());
add(gamePanel);
repaint();
}
public void initTicTacToe() {
TicTacToeGame ttt = new TicTacToeGame();
setSize(ttt.width, ttt.height);
setLayout(null);
add(ttt);
}
public void initMinesweeper() {
MinesweeperGame MsG = new MinesweeperGame(8,10);
setSize(MsG.WIDTH, MsG.HEIGTH);
setLayout(null);
add(MsG);
}
}
Loading…
Cancel
Save