• Post Reply Bookmark Topic Watch Topic
  • New Topic

Syntax Highlightning on JTextArea

 
Thorsten Klonk
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi folks.
Thank you for reading my question.

I started to code a simple text-editor and I want to equip it with a find box, where you can decide if you want to find & replace or only find a regular expression.
"Find & Replace" is doing fine, but how can I realize Syntax-Highlightning, where every found RegEx is coloured?

Here some code:



Greetings,
Thorsten
 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JTextArea does not support highlighting. Check out JTextPane with a StyledDocument.
Resources: Using Text Components and How to Use Editor Panes and Text Panes.
 
Thorsten Klonk
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That was the right hint!

Thank you
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!