Search code examples
javaswingjlabelmultiline

How to add a newline to JLabel without using HTML


How can I add a new line to a JLabel? I know if I use simple HTML, it will work. But if I use HTML, JLabel is not showing the font which embedded with the application. I am embedding the font using the method - createFont() and using JLabel.setFont() for applying the font.


Solution

  • I am Embedding the font using the method - createFont()) and using JLabel.setFont() for applying the font.

    Instead try setting it in the HTML, as shown here.