Search code examples
javanullpointerexceptionrsyntaxtextarea

RSyntaxTextArea NullPointerException when adding new language


I'm trying to add a custom language to RSyntaxTextArea and I keep getting NullPointerException, I don't know the reason since I followed all the steps on http://fifesoft.com/rsyntaxtextarea/doc/CustomSyntaxHighlighting.html

The custom syntax class: http://pastie.org/private/ttadaprzxe9ad0vtgnfeyg

My main class: http://pastie.org/private/kshg6cnrbm495ruipxla#26

I get the NullPointerException on line 26.

I didn't change anything from the Developer's Documentation, besides getWordsToHighlight, So I don't really know what may be causing the error.

I tried to figure what caused the Exception, but cant figure it out :/


Solution

  • You're trying to use textArea before initialising it. Swap line 26 and line 27.