In my application I use a JTextPane embedded in a JScrollPane to display text which is formatted using HTML tags. At first I used JTextArea but then switched to JTextPane to be able to use HTML and colors. Then I needed the JTextPane to support letter based wrapping instead of just the default wrapping by white space. In other words if the content is too long it should be wrapped and the horizontal scroll bar of the JScrollPane should not be visible.
But with this solution the JTextPane ignores any line breaks with the HTML tag <br>. I have to admit I don't really know how the code in the solution works. It would be great if someone could find out how to get the HTML new line <br> tag working with this solution.
TL;DR: how to get this custom HTMLEditorKit to support the HTML "<br>" tag?