Share this page 

Multi-line JLabelTag(s): Swing


Swing 1.1.1 (or better) offers the possibility to use HTML tag to format the JLabel's text. But don't be to fancy since the HTML support is minimal.
JLabel longLabel = new JLabel();
longLabel.setText("<html><body>This is a <p><b>" +
                  "<font size=\"+2\">a label on</font>" +
                  "</b><p>three lines.</body></html>");