Looking for a way to highlight specific words in text areas?

Hi, I’m looking for a way to highlight specific words in text form, for example, how a text editor can work with syntax highlighting. The selection will consist of different colors and / or different styles, such as italics, bold, or regular.

To limit focus, how this can be achieved using Java Swing components.

There are most likely several ways to do this, but this is an effective way to deal with a few selected words and lots of text.

Any feedback is appreciated. Thank.

+3
source share
4 answers

Java JEditorPane: , .

+2

Highlighter, JTextComponent setHighlighter().

+3

JTextPane. , JEditorPane, HTML. , Swing, .

+1

, , - RSyntaxTextArea. , :  -  -  -  - , : C, Java, Ruby, Php, HTML, CSS, Sql ..

+1

Source: https://habr.com/ru/post/1743569/


All Articles