Java JLabel set multi-line text via HTML
import java.awt.BorderLayout; import java.awt.Color; import java.awt.Font; import javax.swing.BorderFactory; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; public class Main extends JFrame { public static void main(String[] args) { String lyrics = "<html>Line<br>line<br>line</html>"; JPanel panel = new JPanel(); panel.setLayout(new BorderLayout(10, 10)); JLabel label = new JLabel(lyrics); panel.add(label, BorderLayout.CENTER); JFrame f = new JFrame(); f.add(panel);/* w w w . jav a 2 s. co m*/ f.pack(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setVisible(true); } }