JavaFX textarea中的多种颜色(JavaFX 8) [英] JavaFX Multiple colors in textarea (JavaFX 8)

查看:383
本文介绍了JavaFX textarea中的多种颜色(JavaFX 8)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在JavaFX中找不到这么多文档。

I cannot find so much documentation in JavaFX.

我很乐意知道如何做到这一点:

And I will be happy to know how I can do this :

当我在textarea中键入单词时,fxgoogle或facebook。我可以这样做,因为它可以改变谷歌的颜色到fx绿色,并改变字体和类似的东西。

When I type a word in a textarea, fx "google" or "facebook". Can I so do like it can change color of google to fx green, and changes the font and stuff like that.

我很乐意知道我怎么做到这一点:)。

I will be happy to know how i can do this :).

推荐答案

不。 JavaFX 8不支持TextArea中文本的多种颜色。

No. JavaFX 8 does not support multiple colors for text in TextArea.

您可以尝试Tomas Mikula的 RichTextFX 控制并查看它是否适合您。

You could try Tomas Mikula's RichTextFX control and see if that works for you.


RichTextFX为JavaFX提供API文本区域设置文本范围。它旨在作为富文本编辑器和代码编辑器的基础,具有语法高亮。

RichTextFX provides a text area for JavaFX with API to style ranges of text. It is intended as a base for rich-text editors and code editors with syntax highlighting.

其他选项包括:


  1. 使用 HTMLEditor

  2. 嵌入许多基于HTML的文本编辑器之一(例如 CKEditor )。

  3. 采用降价样式编辑器,用户只需编辑纯文本标记文本在标准TextArea中,样式文本显示在另一个窗格中(类似于StackOverflow的工作方式)。

  1. To use a HTMLEditor OR
  2. Embed one of the many HTML based text editors (e.g. CKEditor).
  3. Adopt a markdown style editor, where the user just edits plain markup text in a standard TextArea and the styled text is shown in another pane (similar to how StackOverflow works).

寻址其他内容


我找到了一个地方,告诉我可以使用TextFlow。所以我会尝试这个

I found a place, there tell me that I can use TextFlow. So i will try this

TextFlow是一个只读控件,不像TextArea那样可编辑。仅使用核心JavaFX 8组件从头开始创建功能丰富的可定制文本编辑器是一项庞大而复杂的任务,我不建议大多数人承担这一任务。相反,使用或贡献现有的JavaFX编辑器解决方案(如RichTextFX或可能出现的其他类似项目)可能会产生更好的结果和更高效的结果。

TextFlow is a readonly control, not editable like a TextArea is. Creating an feature rich styleable text editor from scratch using only core JavaFX 8 components is a large and complicated task, which I would not advise most people to undertake. Instead, using or contributing to existing JavaFX editor solutions such as RichTextFX or other similar projects which may arise would likely yield better results and a more productive outcome.

这篇关于JavaFX textarea中的多种颜色(JavaFX 8)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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