我正在尝试在Java中传递一个变量,我需要帮助才能使它工作,我已经包含了下面的所有相关代码,我正在使用三个.java文件。 以下是它的设置以及我需要它如何工作的方式;
PROPERTY.java
public enum Property {
BACKGROUND_COLOR("LIME");
}
FxUtils.java
public Scene createScene(Text lowerKey) {
Rectangle2D bounds = getScreenBounds();
Scene scene = new Scene(createRoot(lowerKey), bounds.getWidth(), bounds.getHeight());
scene.setFill(Color.LIME); //WANT TO CHANGE THIS TO A VARIABLE IN PROPERTY
return scene;
}
Main.java
Scene scene = fxUtils.createScene(lowerKey);
答案 0 :(得分:1)
public Scene createScene(Text lowerKey, Color backgroundColor) {
Rectangle2D bounds = getScreenBounds();
Scene scene = new Scene(createRoot(lowerKey), bounds.getWidth(), bounds.getHeight());
scene.setFill(backgroundColor);
return scene;
}
...
createScene(text, Color.RED);