-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPaneOrganizer.java
More file actions
71 lines (61 loc) · 1.92 KB
/
Copy pathPaneOrganizer.java
File metadata and controls
71 lines (61 loc) · 1.92 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
package Evolution;
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.HBox;
import javafx.scene.paint.Color;
/**
*This class models a PaneOrganizer, and is the top-level class.
*/
public class PaneOrganizer {
private BorderPane _root;
/*
* This method constructs a PaneOrganizer, which is responsible for graphical elements that affect the
* entire application.
*/
public PaneOrganizer() {
_root = new BorderPane();
Game game = new Game();
_root.setTop(game.getgamePane());
_root.setCenter(game.getbottomPane());
this.setupButtons();
}
/*
* This method sets up the HBox pane that graphically contains the quit button, and also
* initializes the button and associates its pane with the root pane.
*/
private void setupButtons() {
HBox buttonPane = new HBox();
buttonPane.setStyle("-fx-background-color: #000000;");
_root.setBottom(buttonPane);
Button quit = new Button("Quit!");
quit.setStyle("-fx-base: #5F9EA0");
quit.setTextFill(Color.ANTIQUEWHITE);
quit.setFocusTraversable(false);
buttonPane.getChildren().add(quit);
buttonPane.setAlignment(Pos.CENTER);
quit.setOnAction(new ClickHandler());
}
/**
*This class models a ClickHandler that implements the interface EventHandler<ActionEvent>, and determines\
*what happens when the quit button is clicked.
*/
private class ClickHandler implements EventHandler<ActionEvent> {
/*
* This method determines the changes that occur when the button is clicked; in this case,
* the application is exited.
*/
public void handle(ActionEvent e) {
System.exit(0);
}
}
/*
* This method returns the root pane (a BorderPane), and was created so that the Scene
* could be associated with the root node within the App class.
*/
public BorderPane getRoot() {
return _root;
}
}