本文介绍了JButton和JField标签/文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 JButton ,我想用两行文本来填充文本,但是,当我键入测试并使用\\\
\r我仍然可以在一行上看到文字。



我的 jList 的元素也是如此。

谢谢 使用HTML

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


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

这篇关于JButton和JField标签/文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 16:05