I am implementing a spellchecker and wondered if there is an easy/obvious way of underlining some text in a different colour such as Red.
I have everything set up and u
Use e.g this http://java-sl.com/tip_colored_strikethrough.html
Just modify it a bit to achieve underline rather than strikethrough.
But from my experience to highlight spellcheck errors it's better to define custom highlight painter
See also http://www.java2s.com/Code/Java/Swing-JFC/JTextPaneHighlightExample.htm