For a school assignment we have to program a small snake game. Everything works fine but every now and then the end game screen does not display and spits out this error:
Jun 09, 2019 11:25:27 PM javafx.scene.CssStyleHelper calculateValue WARNING: Could not resolve '-fx-text-background-color' while resolving lookups for '-fx-text-fill' from rule '*.label' in stylesheet jrt:/javafx.controls/com/sun/javafx/scene/control/skin/modena/modena.bss
This seems weird to me as It doesn't do this constantly, just every now and then. My question is what this error means and possibly how to fix it. I can't really show code since my school is kind of strict about sharing assignment work, but I do hope this is enough information to atleast inform me on what the cause of this error might be.
I have added some examples below, it may not be able give an exact replication, but it does give some ideas as to what I'm doing.
Another piece of useful information might be that the DrawPane is constantly updated with an AnimationTimer.
import controller.Controller;
import javafx.geometry.Pos;
import javafx.scene.control.Label;
import javafx.scene.layout.Background;
import javafx.scene.layout.BackgroundFill;
import javafx.scene.layout.FlowPane;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.scene.text.Font;
public class GameOverScene extends FlowPane {
private Label timeAlive;
// constructor
public GameOverScene(Controller controller) {
setAlignment(Pos.TOP_CENTER);
setBackground(new Background(new BackgroundFill(Color.rgb(197, 0, 41), null, null)));
VBox content = new VBox();
content.setAlignment(Pos.TOP_CENTER);
Label gameOverMessage = new Label("Game Over");
gameOverMessage.setFont(new Font("Arial", 40));
timeAlive = new Label(controller.getTimerTime());
timeAlive.setFont(new Font("Arial", 35));
timeAlive.setTextFill(Color.WHITE);
content.getChildren().addAll(gameOverMessage, timeAlive);
getChildren().add(content);
}
public void setTimerTime(String time) {
timeAlive.setText(time);
}
}
public class GameScene extends Scene {
// variables
private DrawPane drawPane;
private BorderPane root;
private DashBoard dashBoardPane;
private GameOverScene gameOver;
private Controller controller;
// constructor
public GameScene(double width, double height, Controller controller, Game game) {
super(new Pane());
this.controller = controller;
root = new BorderPane();
drawPane = new DrawPane(this, game);
dashBoardPane = new DashBoard(controller);
gameOver = new GameOverScene(controller);
root.setCenter(drawPane);
root.setBottom(dashBoardPane);
setRoot(root);
}
public void switchToGameOver() {
gameOver.setTimerTime(controller.getTimerTime());
setRoot(gameOver);
}
}