New Line \n is not working in JButton.setText("fnord\nfoo") ;
awt, java, jbutton, multiline, swing
Solution
JButton accepts HTML, so for the line break to work use:
JButton.setText("<html>fnord<br />foo</html>");
Problem
On a JButton, I want to list information on multiple lines. I tried `\n` as a new line character but it didn't work. The following code: ``` JButton.setText("fnord\nfoo") ; ``` will be displayed as: ``` fnordfoo ``` How do I force a line break?