在JavafX的单个TextArea中将不同的样式应用于字符串 [英] Apply different styles to strings in a single TextArea in JavafX

查看:467
本文介绍了在JavafX的单个TextArea中将不同的样式应用于字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一种方法可以在 TextArea 中设置文本的子字符串? setStyle()方法仅适用于 TextArea 类。

> RichTextFX 。它允许您将样式类添加到文本范围。


Is there a way to style a substring of the text in a TextArea? setStyle() method is only available to the TextArea class.

解决方案

If you are using JDK 8, then this can be achieved by using RichTextFX. It allows you to add style classes to text ranges.

这篇关于在JavafX的单个TextArea中将不同的样式应用于字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆