-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.java
More file actions
45 lines (32 loc) · 1.24 KB
/
App.java
File metadata and controls
45 lines (32 loc) · 1.24 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
41
42
43
44
45
import javax.swing.JFrame;
public class App {
public static void main(String[] args) throws Exception {
System.out.println("Hey");
int rowCount = 21;
int columnCount =19;
int tileSize = 32;
int boardWidth = columnCount * tileSize;
int boardHeight = rowCount * tileSize;
// Creates a JFrame window titled "Pac Man"
JFrame frame = new JFrame("Pac Man");
// Makes the window visible
// frame.setVisible(true);
// Sets the window size to boardWidth and boardHeight
frame.setSize(boardWidth, boardHeight);
// Centers the window on the screen
frame.setLocationRelativeTo(null);
// Prevents resizing of the window
frame.setResizable(false);
// Closes the application when the "X" button is clicked
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//Instance of PacMan class
PacMan pacmanGame = new PacMan();
//Adds game to Board
frame.add(pacmanGame);
//Fills the board with the game
frame.pack();
pacmanGame.requestFocus();
// Makes the window visible
frame.setVisible(true);
}
}