Highlighting Errors

I am using the LanguageTool in a desktop java application that I created. It gets the text from an imported file in a JTextArea and it checks for errors fine but how do I get it to show the highlighting of the errors? (Red: spelling error, Yellow: grammar error)

Thanks

Hi jtcady,

You get no highlights for errors or you see the highlights but you want them to have another color?

The colors for the HighlightPainters are currently hardcoded, but if there is a need for custom colors, we can provide some setters.

regards,
Panagiotis Minos

I do not get highlights for errors as in I see no color markings.

Thanks

Hello jtcady,

You can use org.languagetool.gui.LanguageToolSupport for adding grammar checking support to a JTextComponent. This will handle highlights.

I will create a sample project and upload it later or tomorrow.

Regards,
Panagiotis Minos

Okay, thank you!!

Hi,

I prepared a small demo. You can download it from the following URL

The project has two maven modules. The languagetool-wrapper module contains the needed classes for adding highlighting to a JTextComponent. The languagetool-wrapper-demo module contains code that creates a Window with a JTextArea. The last two lines in the constructor are responsible for adding grammar checking to the textarea.

Best regards,
Panos