Newline in JLabel
formatting, java, jlabel, swing, user-interface
Solution
Surround the string with `<html></html>` and break the lines with `<br/>`.
JLabel l = new JLabel("<html>Hello World!<br/>blahblahblah</html>", SwingConstants.CENTER);
Problem
How can I display a newline in `JLabel`? For example, if I wanted: Hello World! blahblahblah This is what I have right now: ``` JLabel l = new JLabel("Hello World!\nblahblahblah", SwingConstants.CENTER); ``` This is what is displayed: Hello World!blahblahblah Forgive me if this is a dumb question, I'm just learning some Swing basics...