I am trying to change the background of a all ScrollPanes that are defined by my MethodScrollPane class:
package Opmaak.Interfaces.Panes;
import Opmaak.Var;
import javafx.scene.Node;
import javafx.scene.control.ScrollPane;
import javafx.scene.layout.Background;
import javafx.scene.layout.BackgroundFill;
public class MethodScrollPane extends ScrollPane {
public MethodScrollPane(Node content) {
super();
setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
setFitToWidth(true);
setStyle("-fx-background-color:transparent;");
setContent(content);
}
public void setBackgroundMethodScrollPane() {
setBackground(new Background(new BackgroundFill(Var.color, null, null)));
}
}
But how can I achieve this when I change the variable Var.color? I just can't seem to find a solution.
Here's my Var class if it is needed:
package Opmaak;
import javafx.scene.paint.Color;
public class Var {
public static double stageHeight;
public static double stageWidth;
public static Color color;
public static boolean colorChange = false;
public static void setColor(Color color) {
Var.color = color;
// Here I want to change the background of the MethodeScrollPanes
RootPane.setBackgroundColorRoot();
}
}