简体   繁体   中英

Swing - Search text within a JTextField

I have a documents that's displayed in a non-editable JTextField , and I want to enable users to search within this document.

I already figured out I could use a custom JTextField for input , and use the HighLight painter to mark the occurrences - But I couldn't help but feeling that this seems like such a common problem that maybe there's a component that does it much better then I can (like cycling through the results, highlighting them in different colors , ignoring case...)

Do you know of any such thing?

SwingX提供完整的搜索支持(仅在JEditorPane中,叹息:请注意自己 - 其他文本组件怎么样?)

Swing书 (Matthew Robinson和Pavel Vorobiev)在构建HTML编辑器应用程序方面有一个很好的章节,它向您展示了如何实现“查找和替换”。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM