mattbdean
mattbdean

Reputation: 2552

Styled text in JavaFX?

I'm switching my chat client over from Swing to JavaFX, and I have run into a graphical problem. Previously, I was using a JTextPane to insert styled text, but upon switching to FX, I could not find a single component capable of doing what the JTextPane did, and from this answer, I know that FX's TextPane will not do the job either. Sorry if this is obvious to you JavaFX veterans, but I can't quite seem to find anything.

Please, if you could recommend a component like this, it would be much appreciated. Thank you in advance.

Upvotes: 13

Views: 7543

Answers (1)

jewelsea
jewelsea

Reputation: 159341

Styled text will is available in JavaFX 8 (included in jdk8 and jre8) via the TextFlow component.

Here are the details and samples of the feature.

The feature was implemented by the following Multi-line, multi-style, rich text support issue and the related issues it references.

For older (now obsolete) JavaFX versions such as JavaFX 2.2, use a WebView to display styled text and an HTMLEditor to edit it. Or you can place multiple Text or Label nodes in a FlowPane.

Upvotes: 17

Related Questions