forked from Haonan-Hu/Battleship-1
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBattleshipGUI.java
More file actions
118 lines (106 loc) · 2.72 KB
/
BattleshipGUI.java
File metadata and controls
118 lines (106 loc) · 2.72 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/**
Battleship!
KU EECS 448 project 2
TeamName: BigSegFaultEnergy
* \Author: Chance Penner
* \Author: Markus Becerra
* \Author: Sarah Scott
* \Author: Thomas Gardner
* \Author: Haonan Hu
* \File: BattleshipGUI.java
* \Date: 10/14/2019
* \Brief: This class serves as a the executive class of
Battleship as well as making basic gui elements.
KU EECS 448 project 1
TeamName: Poor Yorick
* \Author: Max Goad
* \Author: Jace Bayless
* \Author: Tri Pham
* \Author: Apurva Rai
* \Author: Meet Kapadia
* \File: BattleshipGUI.java
* \Brief: This class serves as a the executive class of
Battleship as well as making basic gui elements.
*/
//Here are erternal classes that need to be imported
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
import javafx.scene.text.*;
import javafx.scene.image.Image;
public class BattleshipGUI extends Application
{
private static Stage stage1;
private static Font font1;
/*
* @ pre none
* @ param array of strings
* @ post launches the file/specific part of the program
* @ return none
*/
public static void main(String[] args)
{
launch(args);
}
/*
* @ pre none
* @ param Stage windom
* @ post starts the stage
* @ return none
*/
@Override
public void start(Stage primaryStage)
{
stage1 = primaryStage;
stage1.setTitle("Battleship!"); //Set the game title
font1 = new Font("Georgia", 20);
//Icon origin: //https://media.istockphoto.com/vectors/aircraft-carrier-transportation-cartoon-character-side-view-vector-vector-id981633486
stage1.getIcons().add(new Image(getClass().getResourceAsStream("icon.jpg")));
stage1.setScene(new MenuScene(stage1, font1).getScene());
stage1.show();
stage1.setAlwaysOnTop(false);
}
/*
* @ pre first scene to be over/done being interacted with
* @ param the next scene and the max size of the screen
* @ post sets the next scene
* @ return none
*/
public static void nextScene(Scene next, int max)
{
stage1.setScene(next);
}
/*
* @ pre none
* @ param none
* @ post gets the next stage
* @ return returns stage
*/
public static Stage getStage() {
return stage1;
}
/*
* @ pre none
* @ param a string thats going to be a title
* @ post changes the title
* @ return none
*/
public void changeTitle(String title)
{
stage1.setTitle(title);
}
/*
* @ pre none
* @ param none
* @ post gets the font
* @ return returns the font
*/
public static Font getFont()
{
return font1;
}
}