-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPaneOrganizer.java
46 lines (37 loc) · 1.04 KB
/
PaneOrganizer.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
package Pacman;
/*
* This class sets up and organizes the different panes for the game and also adds a quit button to the screen
*/
import javafx.application.Platform;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Pos;
import javafx.scene.control.Button;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.VBox;
public class PaneOrganizer {
BorderPane _root;
public PaneOrganizer() {
_root = new BorderPane();
Pacman pacman = new Pacman();
_root.setCenter(pacman.getpane());
this.setupButtons();
}
public BorderPane getRoot() {
return _root;
}
private void setupButtons() {
VBox buttonPane = new VBox();
buttonPane.setAlignment(Pos.BASELINE_RIGHT);
_root.setBottom(buttonPane);
Button _button = new Button("Quit");
buttonPane.getChildren().addAll(_button);
buttonPane.setSpacing(30);
_button.setOnAction(new ActionHandler());
}
private class ActionHandler implements EventHandler<ActionEvent> {
public void handle(ActionEvent event) {
Platform.exit();
}
}
}