Codeversum
Codeversum

Reputation: 327

Format an editable textarea

At the moment I try to find a method to create a TextArea that I can edit and simply (without cheating) apply syntax highlighting to. Is that possible without the need of a custom Component? I already managed to format a text using a JEditorPane, but I am not sure how to implement that the text is dynamicly highlighted... And that efficiently. Is that possibly without an enormous amount of coding?

Upvotes: 0

Views: 79

Answers (1)

camickr
camickr

Reputation: 324108

You can't use a JTextArea since it does not support text attributes.

Instead you can use a JTextPane. Read the section from the Swing tutorial on Text Component Features for more information and examples.

Upvotes: 2

Related Questions