-
Notifications
You must be signed in to change notification settings - Fork 2
/
GameWindow.java
45 lines (41 loc) · 941 Bytes
/
GameWindow.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
import java.util.concurrent.TimeUnit;
import javax.swing.JFrame;
/**
* @author Derick Owens
*
*/
public class GameWindow extends JFrame {
/**
* Call screen to produce the game in a window
*/
public GameWindow(){
setTitle("Space Invaders");
Screen screen = new Screen();
add(screen);
setResizable(false);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
pack();
setVisible(true);
}
/**
* Create SpaceInvaders window.
* @param args Ignored.
*/
public static void main(String[] args){
JFrame startFrame = new JFrame("Space Invaders");
StartScreen start = new StartScreen();
startFrame.add(start);
startFrame.pack();
startFrame.setResizable(false);
startFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
startFrame.setVisible(true);
try {
TimeUnit.SECONDS.sleep(4);
}
catch(InterruptedException e) {
e.printStackTrace();
}
startFrame.dispose();
new GameWindow();
}
}