forked from bramanudom/tune_in_game
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTuneInGUI.java~
executable file
·80 lines (62 loc) · 2.24 KB
/
TuneInGUI.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/* Pet, Alice, and Jacqueline
* TuneInGUI.java
* application will run the game with the accompanying GUIS
* December 9, 2015 */
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class TuneInGUI {
private static JFrame frame = new JFrame("Tune In GUI");
static JPanel cards = new JPanel(); // Panel where all the "cards" will be added
// MelodyCollection gameMelodies = new MelodyCollection();
static PlayGame game = new PlayGame();
public static CardLayout cl = new CardLayout();
// create a new playGame object
// PlayGame game = new PlayGame (1,gameMelodies);
// The cards
JPanel instructions;
JPanel playPanel;
JPanel openingScreen;
JPanel incorrect;
JPanel correct;
JPanel winGame;
//
//JPanel selectLevel = new SelectLevel();
public TuneInGUI () {
instructions = new InstructionsPanel();
playPanel = new PlayPanel(game);
openingScreen = new OpeningScreenPanel();
incorrect = new IncorrectPanel();
correct = new CorrectPanel();
winGame = new WinGamePanel();
// Setting layout to card layout
cards.setLayout(cl);
// Adding cards
cards.add(openingScreen, "Opening Screen");
cards.add(instructions, "Instructions");
//cards.add(selectLevel, "Select Level");
cards.add(playPanel, "Play Panel");
cards.add(incorrect, "Incorrect Screen");
cards.add(correct, "Correct Screen");
cards.add(winGame, "Win Game Screen");
// Shows the Opening Screen for the initial screen
cl.show(cards, "Opening Screen");
frame.setPreferredSize(new Dimension(1200, 450));
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().add(cards);
frame.pack();
frame.setVisible(true);
}
// I have no idea what this does but it's supposed to runs everything lol.
// I found it on the internet. Used something similar in Unity over the summer.
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
TuneInGUI game = new TuneInGUI();
game.frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
game.frame.setVisible(true);
}
});
}
}