I have a JButton
that I would like to fill in with text that would spread in two lines, however, when I type in the test and use "\n"
or "\r"
I still get the text on one line.
This is the case with the elements of my jList
as well.
Thanks
I have a JButton
that I would like to fill in with text that would spread in two lines, however, when I type in the test and use "\n"
or "\r"
I still get the text on one line.
This is the case with the elements of my jList
as well.
Thanks
Use HTML
JButton button = new JButton("<html><body>line 1 <br /> line 2</body></html>");
Indeed, JButton admits HTML. However <body>
is not really necessary:
JButton button = new JButton("<html> mylabel <br /> mylabel continues on a newline </html>");
[[ taken from New Line \n is not working in JButton.setText("fnord\nfoo") ; ]]