-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathControllerClass.java
66 lines (54 loc) · 1.87 KB
/
ControllerClass.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
@SuppressWarnings("serial")
/*
* Main Class - Here starts all
*
*
* COPYRIGHT
* ©2013 by Kim Jeker (info@kije.ch)
* Source available on GitHub (https://github.com/kije/KJMiniGames)
*
*/
public class ControllerClass extends JFrame implements ActionListener {
// Die einzelnen "Unterprogramme"
public KJMineSweeper mineSweeper;
public KJNumberQuiz numberQuiz;
public KJMiniGamesDocumentation documentation;
// Die Buttons um die verschiedenen Anwendungen zu starten
public JButton mineSweeperButton = new JButton("MineSweeper");
public JButton numbersQuizButton = new JButton("Zahlen raten");
public JButton documentationButton = new JButton("Dokumentation");
/************* MAIN **************/
public static void main(String[] args) {
new ControllerClass();
}
/*********** END MAIN ***********/
public ControllerClass() {
// Fenster vorbereiten
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setTitle("Projekt - Modul 103 - Kim Jeker");
setLayout(new FlowLayout());
setResizable(false);
// Buttons hinzufügen
mineSweeperButton.addActionListener(this);
add(mineSweeperButton);
numbersQuizButton.addActionListener(this);
add(numbersQuizButton);
documentationButton.addActionListener(this);
add(documentationButton);
pack();
setLocationRelativeTo(null); // Fenster zentrieren
setVisible(true);
}
public void actionPerformed(ActionEvent event) {
if (event.getSource() == mineSweeperButton) {
mineSweeper = new KJMineSweeper("MineSweeper", 15, 15, 0.1); // Minesweeper starten
} else if (event.getSource() == numbersQuizButton) {
numberQuiz = new KJNumberQuiz("Number Quiz"); // Number Quiz starten
} else if (event.getSource() == documentationButton) {
documentation = new KJMiniGamesDocumentation("Dokumentation"); // Dokumentation anzeigen
}
}
}