【问题标题】:JavaFX - RichTextFX - How to change highlight text colorJavaFX - RichTextFX - 如何更改高亮文本颜色
【发布时间】:2021-08-21 21:13:09
【问题描述】:

我正在使用 RichTextFX 的 StyleClassedTextArea 实例,但在突出显示时似乎无法更改文本本身的颜色。

有一个类似的问题:RichTextFx change selected text color and line number background 这对我有帮助,但答案只会改变实际的突出显示颜色,而不是突出显示时的文本本身。我希望突出显示的文本本身是白色的,这样更易​​读。

另一个问题的答案如下:

.styled-text-area .selection {
    -fx-fill: pink;
}

我尝试了其他方法来让文本本身改变颜色,例如:

.styled-text-area .selection .text {
    -fx-fill: white;
}


.styled-text-area .selection {
    -fx-highlight-fill: white;
}

但我似乎什么也做不了。正常的 -fx-text-fill 语法似乎不适用于 RichTextFX。

【问题讨论】:

  • 我的第一个猜测是.styled-text-area .selection { -fx-text-fill: white ; }
  • 是的,我同意,但由于某种原因,这不适用于 RichTextFX,仅适用于 -fx-fill。 @James_D
  • 尝试像这样改变字体颜色 .styled-text-area{-fx-font-color: red;}

标签: java user-interface javafx textarea richtextfx


【解决方案1】:

你可以试试 -rtfx-background-color: yellow;

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-09-02
    • 1970-01-01
    • 2010-11-07
    • 1970-01-01
    • 1970-01-01
    • 2013-07-16
    相关资源
    最近更新 更多