-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFrame.java
49 lines (34 loc) · 1006 Bytes
/
Frame.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
package uet.oop.bomberman.gui;
import uet.oop.bomberman.Game;
import javax.swing.*;
import java.awt.*;
/**
* Swing Frame chứa toàn bộ các component
*/
public class Frame extends JFrame {
public GamePanel _gamepane;
private JPanel _containerpane;
private InfoPanel _infopanel;
private Game _game;
public Frame() {
_containerpane = new JPanel(new BorderLayout());
_gamepane = new GamePanel(this);
_infopanel = new InfoPanel(_gamepane.getGame());
_containerpane.add(_infopanel, BorderLayout.PAGE_START);
_containerpane.add(_gamepane, BorderLayout.PAGE_END);
_game = _gamepane.getGame();
add(_containerpane);
setResizable(false);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
pack();
setLocationRelativeTo(null);
setVisible(true);
_game.start();
}
public void setTime(int time) {
_infopanel.setTime(time);
}
public void setPoints(int points) {
_infopanel.setPoints(points);
}
}