-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
31 lines (25 loc) · 1 KB
/
Main.java
File metadata and controls
31 lines (25 loc) · 1 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
package lab13;
import javax.swing.*;
public class Main {
public static void main(String[] args) {
// write your code here
JFrame frame = new JFrame("Zombie");
SpriteFactory factory = ZombieFactory.getInstance();
DrawPanel panel = new DrawPanel(Main.class.getResource("\\resources\\background_img.jpg"), factory);
frame.setContentPane(panel);
frame.setSize(1000, 700);
frame.setLocationRelativeTo(null);
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
frame.setResizable(true);
frame.setVisible(true);
frame.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent windowEvent) {
// tu zatrzymaj watek
// ale nie za pomocą metody stop() !!!
System.exit(0);
//zatrzymaj też timer celownika za pomocą cancel(). Timer to także wątek...
}
});
}
}