我正在尝试在 Java 中显示工具提示,它可能是也可能不是段落长度。如何对长工具提示进行自动换行?
如果将工具提示包裹在<html>
and </html>
标签,你可以用以下方式换行<br>
标签。看https://web.archive.org/web/20060625031340/http://www.jguru.com/faq/view.jsp?EID=10653 https://web.archive.org/web/20060625031340/http://www.jguru.com/faq/view.jsp?EID=10653供示例和讨论。该讨论的主要结论是:fButton.setToolTipText("<html><font face=\"sansserif\" color=\"green\">first line<br>second line</font></html>");
或者您可以使用 JMultiLineToolTip 类,该类可以在网上很多地方找到,包括https://github.com/ls-cwi/yoshiko-app/blob/master/src/main/java/com/yoshiko/internal/view/JMultiLineToolTip.java https://github.com/ls-cwi/yoshiko-app/blob/master/src/main/java/com/yoshiko/internal/view/JMultiLineToolTip.java
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)