Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 JButton 上,我想在多行上列出信息。我尝试\n作为换行符,但没有用。以下代码:
\n
JButton.setText("fnord\nfoo") ;
将显示为:
fnordfoo
如何强制换行?
JButton 接受 HTML,因此要使换行符起作用,请使用:
JButton.setText("<html>fnord<br />foo</html>");