Style change to an element
This commit is contained in:
@@ -9,7 +9,7 @@ import javafx.scene.control.Button;
|
|||||||
import javafx.animation.AnimationTimer;
|
import javafx.animation.AnimationTimer;
|
||||||
|
|
||||||
public class GameOfLife extends Application{
|
public class GameOfLife extends Application{
|
||||||
private static Cell[][] cells;
|
private Cell[][] cells;
|
||||||
@Override
|
@Override
|
||||||
public void start(Stage primaryStage) throws Exception {
|
public void start(Stage primaryStage) throws Exception {
|
||||||
cells = new Cell[64][64];
|
cells = new Cell[64][64];
|
||||||
@@ -46,6 +46,7 @@ public class GameOfLife extends Application{
|
|||||||
stop.setOnAction(event->{
|
stop.setOnAction(event->{
|
||||||
animate.stop();
|
animate.stop();
|
||||||
});
|
});
|
||||||
|
|
||||||
Button start = new Button("Start");
|
Button start = new Button("Start");
|
||||||
start.setOnAction(event->{
|
start.setOnAction(event->{
|
||||||
animate.start();
|
animate.start();
|
||||||
@@ -53,8 +54,10 @@ public class GameOfLife extends Application{
|
|||||||
|
|
||||||
root.add(start, cells.length, cells[cells.length-1].length);
|
root.add(start, cells.length, cells[cells.length-1].length);
|
||||||
root.add(stop, cells.length, cells[cells.length-1].length+1);
|
root.add(stop, cells.length, cells[cells.length-1].length+1);
|
||||||
|
root.setStyle("-fx-background-color: white");
|
||||||
|
|
||||||
Scene scene = new Scene(root);
|
Scene scene = new Scene(root);
|
||||||
|
|
||||||
primaryStage.setTitle("Conway's Game of Life");
|
primaryStage.setTitle("Conway's Game of Life");
|
||||||
primaryStage.setScene(scene);
|
primaryStage.setScene(scene);
|
||||||
primaryStage.show();
|
primaryStage.show();
|
||||||
|
|||||||
Reference in New Issue
Block a user