JavaFX Text in TextFlow ignores StyleClass?

Viewed 523

I try to use a javafx TextFlow to view some styled text. The following code does not do any text styling.

public Node createText(String t,String cls){
    Text ret = new Text(t); 
    ret.getStyleClass().add(cls);
    return ret;
}

When I replace Text with Label it works properly, but things like \n obviously do not work anymore. How can I use the Text class with css classes?

EDIT: As requested a short example of my default.css

.defaultElementAttr{
    -fx-text-fill:#48a711;  
} 
1 Answers
Related