JavaFX TreeView异常

3月 01, 2019 11:42:26 上午 javafx.scene.CssStyleHelper calculateValue
警告: Could not resolve '-fx-text-background-color' while resolving lookups for '-fx-text-fill' from rule '*.check-box' in stylesheet jar:file:///C:/Users/28954/.m2/repository/org/openjfx/javafx-controls/11.0.2/javafx-controls-11.0.2-win.jar!/com/sun/javafx/scene/control/skin/modena/modena.bss
3月 01, 2019 11:42:26 上午 javafx.scene.CssStyleHelper calculateValue
警告: Could not resolve '-fx-text-background-color' while resolving lookups for '-fx-text-fill' from rule '*.check-box' in stylesheet jar:file:///C:/Users/28954/.m2/repository/org/openjfx/javafx-controls/11.0.2/javafx-controls-11.0.2-win.jar!/com/sun/javafx/scene/control/skin/modena/modena.bss
3月 01, 2019 11:42:26 上午 javafx.scene.CssStyleHelper calculateValue
警告: Caught 'java.lang.ClassCastException: class java.lang.String cannot be cast to class javafx.scene.paint.Paint (java.lang.String is in module java.base of loader 'bootstrap'; javafx.scene.paint.Paint is in module javafx.graphics of loader 'app')' while converting value for '-fx-background-color' from rule '*.check-box>*.box' in stylesheet jar:file:///C:/Users/28954/.m2/repository/org/openjfx/javafx-controls/11.0.2/javafx-controls-11.0.2-win.jar!/com/sun/javafx/scene/control/skin/modena/modena.bss
3月 01, 2019 11:42:26 上午 javafx.scene.CssStyleHelper calculateValue
警告: Could not resolve '-fx-text-background-color' while resolving lookups for '-fx-text-fill' from rule '*.tree-cell' in stylesheet jar:file:///C:/Users/28954/.m2/repository/org/openjfx/javafx-controls/11.0.2/javafx-controls-11.0.2-win.jar!/com/sun/javafx/scene/control/skin/modena/modena.bss
3月 01, 2019 11:42:26 上午 javafx.scene.CssStyleHelper calculateValue
警告: Caught 'java.lang.ClassCastException: class java.lang.String cannot be cast to class javafx.scene.paint.Paint (java.lang.String is in module java.base of loader 'bootstrap'; javafx.scene.paint.Paint is in module javafx.graphics of loader 'app')' while converting value for '-fx-background-color' from rule '*.tree-cell' in stylesheet jar:file:///C:/Users/28954/.m2/repository/org/openjfx/javafx-controls/11.0.2/javafx-controls-11.0.2-win.jar!/com/sun/javafx/scene/control/skin/modena/modena.bss
3月 01, 2019 11:42:26 上午 javafx.scene.CssStyleHelper calculateValue
警告: Could not resolve '-fx-text-background-color' while resolving lookups for '-fx-text-fill' from rule '*.tree-cell' in stylesheet jar:file:///C:/Users/28954/.m2/repository/org/openjfx/javafx-controls/11.0.2/javafx-controls-11.0.2-win.jar!/com/sun/javafx/scene/control/skin/modena/modena.bss
3月 01, 2019 11:42:26 上午 javafx.scene.CssStyleHelper calculateValue
警告: Caught 'java.lang.ClassCastException: class java.lang.String cannot be cast to class javafx.scene.paint.Paint (java.lang.String is in module java.base of loader 'bootstrap'; javafx.scene.paint.Paint is in module javafx.graphics of loader 'app')' while converting value for '-fx-background-color' from rule '*.tree-cell' in stylesheet jar:file:///C:/Users/28954/.m2/repository/org/openjfx/javafx-controls/11.0.2/javafx-controls-11.0.2-win.jar!/com/sun/javafx/scene/control/skin/modena/modena.bss
3月 01, 2019 11:42:26 上午 javafx.scene.CssStyleHelper calculateValue
警告: Could not resolve '-fx-text-background-color' while resolving lookups for '-fx-text-fill' from rule '*.tree-cell' in stylesheet jar:file:///C:/Users/28954/.m2/repository/org/openjfx/javafx-controls/11.0.2/javafx-controls-11.0.2-win.jar!/com/sun/javafx/scene/control/skin/modena/modena.bss
3月 01, 2019 11:42:26 上午 javafx.scene.CssStyleHelper calculateValue
警告: Caught 'java.lang.ClassCastException: class java.lang.String cannot be cast to class javafx.scene.paint.Paint (java.lang.String is in module java.base of loader 'bootstrap'; javafx.scene.paint.Paint is in module javafx.graphics of loader 'app')' while converting value for '-fx-background-color' from rule '*.tree-cell' in stylesheet jar:file:///C:/Users/28954/.m2/repository/org/openjfx/javafx-controls/11.0.2/javafx-controls-11.0.2-win.jar!/com/sun/javafx/scene/control/skin/modena/modena.bss
3月 01, 2019 11:42:26 上午 javafx.scene.CssStyleHelper calculateValue
警告: Could not resolve '-fx-text-background-color' while resolving lookups for '-fx-text-fill' from rule '*.tree-cell' in stylesheet jar:file:///C:/Users/28954/.m2/repository/org/openjfx/javafx-controls/11.0.2/javafx-controls-11.0.2-win.jar!/com/sun/javafx/scene/control/skin/modena/modena.bss
3月 01, 2019 11:42:26 上午 javafx.scene.CssStyleHelper calculateValue
警告: Caught 'java.lang.ClassCastException: class java.lang.String cannot be cast to class javafx.scene.paint.Paint (java.lang.String is in module java.base of loader 'bootstrap'; javafx.scene.paint.Paint is in module javafx.graphics of loader 'app')' while converting value for '-fx-background-color' from rule '*.tree-cell' in stylesheet jar:file:///C:/Users/28954/.m2/repository/org/openjfx/javafx-controls/11.0.2/javafx-controls-11.0.2-win.jar!/com/sun/javafx/scene/control/skin/modena/modena.bss
3月 01, 2019 11:42:26 上午 javafx.scene.CssStyleHelper calculateValue
警告: Could not resolve '-fx-text-background-color' while resolving lookups for '-fx-text-fill' from rule '*.tree-cell' in stylesheet jar:file:///C:/Users/28954/.m2/repository/org/openjfx/javafx-controls/11.0.2/javafx-controls-11.0.2-win.jar!/com/sun/javafx/scene/control/skin/modena/modena.bss
3月 01, 2019 11:42:26 上午 javafx.scene.CssStyleHelper calculateValue
警告: Caught 'java.lang.ClassCastException: class java.lang.String cannot be cast to class javafx.scene.paint.Paint (java.lang.String is in module java.base of loader 'bootstrap'; javafx.scene.paint.Paint is in module javafx.graphics of loader 'app')' while converting value for '-fx-background-color' from rule '*.tree-cell' in stylesheet jar:file:///C:/Users/28954/.m2/repository/org/openjfx/javafx-controls/11.0.2/javafx-controls-11.0.2-win.jar!/com/sun/javafx/scene/control/skin/modena/modena.bss
3月 01, 2019 11:42:26 上午 javafx.scene.CssStyleHelper calculateValue
警告: Could not resolve '-fx-text-background-color' while resolving lookups for '-fx-text-fill' from rule '*.tree-cell' in stylesheet jar:file:///C:/Users/28954/.m2/repository/org/openjfx/javafx-controls/11.0.2/javafx-controls-11.0.2-win.jar!/com/sun/javafx/scene/control/skin/modena/modena.bss
3月 01, 2019 11:42:26 上午 javafx.scene.CssStyleHelper calculateValue
警告: Caught 'java.lang.ClassCastException: class java.lang.String cannot be cast to class javafx.scene.paint.Paint (java.lang.String is in module java.base of loader 'bootstrap'; javafx.scene.paint.Paint is in module javafx.graphics of loader 'app')' while converting value for '-fx-background-color' from rule '*.tree-cell' in stylesheet jar:file:///C:/Users/28954/.m2/repository/org/openjfx/javafx-controls/11.0.2/javafx-controls-11.0.2-win.jar!/com/sun/javafx/scene/control/skin/modena/modena.bss

我在fxml里面定义了一个TreeView标签:

<TreeView fx:id="tree" styleClass="tree" />

然后会多次修改这个TreeView,所以就出现了上面的警告。
解决办法就是生成TreeView也在代码中,每次插入这个TreeView对象。