Nur die besten Spiele ;3
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

100 lines
2.2 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. package hauptmenue;
  2. import java.awt.Dimension;
  3. import java.awt.event.ActionEvent;
  4. import java.awt.event.ActionListener;
  5. import java.awt.event.MouseAdapter;
  6. import java.awt.event.MouseEvent;
  7. import javax.swing.JButton;
  8. import javax.swing.JFrame;
  9. import Minesweeper.MinesweeperGame;
  10. import TicTacToe.TicTacToeGame;
  11. import solitaer.SolitaerGamePanel;
  12. import solitaer.SolitaerMenue;
  13. public class GameWindow extends JFrame {
  14. private static final long serialVersionUID = 1L;
  15. public GameWindow() {
  16. setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  17. setSize(new Dimension(200, 125));
  18. setLayout(null);
  19. JButton soli = new JButton("Solitaer");
  20. JButton Tic = new JButton("TicTacToe");
  21. JButton Mine = new JButton("Minesweeper");
  22. soli.addActionListener(new ActionListener() {
  23. @Override
  24. public void actionPerformed(ActionEvent e) {
  25. soli.setVisible(false);
  26. Tic.setVisible(false);
  27. Mine.setVisible(false);
  28. initSoli();
  29. }
  30. });
  31. Tic.addActionListener(new ActionListener() {
  32. @Override
  33. public void actionPerformed(ActionEvent e) {
  34. soli.setVisible(false);
  35. Tic.setVisible(false);
  36. Mine.setVisible(false);
  37. initTicTacToe();
  38. }
  39. });
  40. Mine.addActionListener(new ActionListener() {
  41. @Override
  42. public void actionPerformed(ActionEvent e) {
  43. soli.setVisible(false);
  44. Tic.setVisible(false);
  45. Mine.setVisible(false);
  46. initMinesweeper();
  47. }
  48. });
  49. soli.setBounds(0, 0, 200, 30);
  50. Tic.setBounds(0, 30, 200, 30);
  51. Mine.setBounds(0, 60, 200, 30);
  52. add(soli);
  53. add(Tic);
  54. add(Mine);
  55. setVisible(true);
  56. }
  57. private void initSoli() {
  58. SolitaerGamePanel gamePanel = new SolitaerGamePanel();
  59. SolitaerMenue smenue = new SolitaerMenue(gamePanel);
  60. gamePanel.setVisible(true);
  61. gamePanel.setSize(new Dimension(1180, 780));
  62. setSize(new Dimension(1180, 780));
  63. //gamePanel.setPreferredSize(new Dimension(1180, 780));
  64. setJMenuBar(smenue.getMenue());
  65. add(gamePanel);
  66. repaint();
  67. }
  68. public void initTicTacToe() {
  69. TicTacToeGame ttt = new TicTacToeGame();
  70. setSize(ttt.width, ttt.height);
  71. setLayout(null);
  72. add(ttt);
  73. }
  74. public void initMinesweeper() {
  75. MinesweeperGame MsG = new MinesweeperGame(8,10);
  76. setSize(MsG.WIDTH, MsG.HEIGTH);
  77. setLayout(null);
  78. add(MsG);
  79. }
  80. }