JButton and JField labels/text?

好久不见. 提交于 2019-12-01 23:40:59

Use HTML

JButton button = new JButton("<html><body>line 1 <br /> line 2</body></html>");
mario go

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") ; ]]

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!