I should want to implement a search functionality in a JTextPane. I already use swingx, and I see Searchable interface, with a JXEditorPane.DocumentSearchable. I suppose it’s for JXEditorPane.
But I use a JTextPane. Is there some exemple with that ?
Thanks.
If you want to reuse the search components provided by SwingX (for example the
JXFindBar) for yourJTextPaneit is sufficient to create an implementation of theSearchableinterface which works against yourJTextPane. ThisSearchableinstance can then be passed to theJXFindBar.The
JXEditorPane.DocumentSearchableis more or less what you want since it works against aDocument(see source code) so starting from this source code you should have your own implementation ready in a jiffy.