How to get highlighted text in a jtextarea

后端 未结 2 443
你的背包
你的背包 2021-01-23 04:01

I have a jtextarea with some texts. I use java highligher to highlight some texts on that jtextarea. I want to print the content of that textarea to another textarea with the hi

相关标签:
2条回答
  • 2021-01-23 04:21

    Use the getHighlights() method of your Highlighter. From there, you can retrieve the offsets of the start and end of highlighting.

    0 讨论(0)
  • 2021-01-23 04:31

    You can just ask the text area for the selected text using the getSelectedText method.

    0 讨论(0)
提交回复
热议问题