如何在jtextarea中获取突出显示的文本 [英] How to get highlighted text in a jtextarea

查看:196
本文介绍了如何在jtextarea中获取突出显示的文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些带有一些文字的jtextarea。我使用java highligher来突出显示jtextarea上的一些文本。我想用优化文本将该textarea的内容打印到另一个textarea。那可能吗?
或者是否有任何方法只能在jtextarea中获取突出显示的文本?

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 highlighted texts. Is that possible? Or is there any way of getting only the highlighted text inside a jtextarea?

推荐答案

使用 getHighlights()荧光笔的方法。从那里,您可以检索突出显示的开始和结束的偏移。

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

这篇关于如何在jtextarea中获取突出显示的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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