Highlighting strings in JavaFX TextArea [duplicate]

匿名 (未验证) 提交于 2019-12-03 01:58:03

问题:

Possible Duplicate:
Highlighting Strings in JavaFX TextArea

how to highlight the text in the textarea? For example in ms-word if we write the text in the find option the same text will highlight in the text area in the same way i wanted to do that in javafx can any one help me?

回答1:

Unfortunately rich text is not yet supported (fx 2.2).

You can try next workarounds:

  1. Use RichTextEditor
  2. Use WebView
  3. Draw several Text on Canvas
  4. Just put Text/Labels with different formatting in HBox or TilePane.
  5. Create a transparent pane over the TextArea and draw an opaque highlights, but this can be hard due to complexity of finding out exact words coordinates.


标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!