Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Is it possible to paint a background color for a Text in Javafx 8?

1056224Feb 6 2014 — edited Feb 12 2014

Hello,

we are currently designing an application where the user imports some text which is then analyzed for specific keywords. These keywords should then be highlighted in the text so that the user can easily see which words have been found.

Now with Java 8 we'd like to use the new TextFlow class for this. I know that I can easily change the font of the words that have been identified, but it would also be nice if I could add a background color for even easier visual scanning of the text. Is there anyway how to achieve this using the Text class? I know that I could also add a label to the TextFlow, however this would break the flow of the Text because sometimes we also need to highlight larger parts of the text, and if that text extends beyond the end of the line the linkebreaks will just be hideous.

I already thought about subclassing Text and a background, but simply do not know where I would have to change the way how the rendering happens.

Any tips would be appreciated

This post has been answered by 1056224 on Feb 12 2014
Jump to Answer

Comments

Gbenga Ajakaye

Interesting stuff. Thanks for the video.

1 - 1
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Mar 12 2014
Added on Feb 6 2014
3 comments
1,841 views