-
Notifications
You must be signed in to change notification settings - Fork 0
/
GamePane.java
58 lines (46 loc) · 1.35 KB
/
GamePane.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
46
47
48
49
50
51
52
53
54
55
56
57
58
import javafx.scene.layout.Pane;
import javafx.scene.text.*;
import javafx.scene.control.Button;
/**
* Write a description of class DefaultPane here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class GamePane extends DefaultPane
{
private Text txtScore;
private Text txtLost;
private Button btnHome;
private Button btnNext;
public GamePane()
{
//INITIALIZE NODES
this.txtScore = new Text(50,50,"0");
this.txtLost = new Text(50, 100, "YOU LOST!!!");
this.btnHome = new Button("HOME");
this.btnNext = new Button("NEXT");
this.txtLost.setVisible(false);
this.btnNext.setVisible(false);
//btnHome.setLayoutY(230);
//SET BUTTON FUNCTIONALITY
this.btnHome.setOnAction(event -> {
super.changePane();
});
this.btnNext.setOnAction(event -> {
super.changePane();
});
//ADD ALL NODES TO PANE
this.getChildren().addAll(txtScore, btnHome);
System.out.println("hello");
}
public void setScore(String strScore)
{
this.txtScore.setText(strScore);
}
public void showLosingScreen()
{
this.txtLost.setVisible(true);
this.btnNext.setVisible(true);
}
}