-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWindow.java
More file actions
executable file
·34 lines (32 loc) · 896 Bytes
/
Copy pathWindow.java
File metadata and controls
executable file
·34 lines (32 loc) · 896 Bytes
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
/*
-> Flydom Source Code
-> Adam Fiedler (c) 2014
*/
import java.awt.Component;
import javax.swing.JFrame;
class Window extends JFrame {
private Flydom flydom;
private Component game;
// Creating a window
public Window(int width, int height) {
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setSize(width, height);
// Add the game
this.setTitle("Flydom v" + Flydom.VERSION);
this.flydom = new Flydom(this);
this.game = this.add(this.flydom);
this.setVisible(true);
}
public void reset() {
this.remove(this.game);
Obstacle.removeAll();
this.flydom = null;
this.game = null;
System.gc();
this.flydom = new Flydom(this);
this.game = this.add(this.flydom);
this.revalidate();
this.repaint();
this.game.requestFocusInWindow();
}
}