-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGameFrame.java
More file actions
40 lines (33 loc) · 1.03 KB
/
Copy pathGameFrame.java
File metadata and controls
40 lines (33 loc) · 1.03 KB
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
import javax.swing.*;
public class GameFrame {
private final JFrame frame = new JFrame(); //creates the frame
static final int FRAME_HEIGHT = 720; // Height of the JFrame
static final int FRAME_WIDTH = 1280; // Width of the JFrame
/**
* Creates the gameFrame
*/
public GameFrame() {
frame.setLayout(null);
frame.setSize(FRAME_WIDTH, FRAME_HEIGHT);
frame.setTitle("Tank Simulator");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setResizable(true);
frame.setVisible(true);
frame.setLocationRelativeTo(null);
mainMenu();
}
/**
* Sets JFrame to MainMenu panel
*/
public void mainMenu() {
MainMenu m = new MainMenu(frame); //creates MainMenu object
}
/**
* Sets JFrame to game
*/
public void startGame() {
GamePanel panel = new GamePanel(); //Creates GamePanel object
panel.setVisible(true);
frame.setContentPane(panel);
}
}