Repository navigation
Expand file tree
/
Copy pathG.java
More file actions
58 lines (47 loc) · 1.51 KB
/
Copy pathG.java
File metadata and controls
58 lines (47 loc) · 1.51 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
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.geometry.Insets;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.layout.GridPane;
import javafx.stage.Stage;
import javafx.scene.layout.Pane;
/**
* Inherits javaFx application class. This is basically the window of the application and it will display and give functionality to the scenes in the program -- the sole
* functionality this class is used for.
*
*
* @author (Huy Nguyen)
* @version (Jan 9 2024)
*/
public class G extends Application
{
private Scene scene;
private StartPane startPane;
private GamePane gamePane;
public void test()
{
start(new Stage());
}
@Override
public void start(Stage stage)
{
this.startPane = new StartPane();
this.gamePane = new GamePane();
this.scene = new Scene(startPane, 500, 1000);
stage.setScene(scene);
System.out.println("here");
//required to completely terminate java virtual machine, otherwise java virtual machine will keep running and javafx application cannot be run again
stage.setOnCloseRequest(event -> {
System.exit(0);
//Platform.exit(); // Exit the application
});
stage.show(); //launch stage
}
public void switchPane()
{
this.scene.setRoot(this.startPane);
}
}