public class RichTextFxTest extends Application {
private final InlineCssTextArea textArea = new InlineCssTextArea();
@Override
public void start(Stage stage) throws Exception {
var root = new VBox(textArea);
textArea.append("My first text. ", "-fx-fill: green;-fx-font-weight:bold");
textArea.append("My second text. ", "-fx-fill: red;");
var scene = new Scene(root, 300, 200);
stage.setScene(scene);
stage.show();
}
}
And this is the result:
I append the first text with bold font weight and I want this style was set to all texts until I set -fx-font-weight: normal. However, as you see in the picture the second text is not bold (although I didn't do -fx-font-weight: normal).
This is my test code:
And this is the result:
I append the first text with bold font weight and I want this style was set to all texts until I set
-fx-font-weight: normal
. However, as you see in the picture the second text is not bold (although I didn't do-fx-font-weight: normal
).Could anyone say how to do it, if it is possible?