如何在 Java GUI 上添加多行标签?
我做了一个java swing GUI。现在我想在其上显示一条静态消息,但该消息是多行的,而 JLabel 是单行的。
我怎样才能显示该消息?
我们可以设置 JLabel 的任何属性来显示多行消息吗?
我是否必须为多行使用多个 JLabel?
还有其他方法可以显示该消息吗?
I have made a java swing GUI. Now I want to display a static message on that but the message is multi-line and the JLabel is single line.
How can I display that message?
Is there any property of JLabel which we can set to display the multiple line message?
Will I have to use several JLabels for multiple lines?
Is there any other way I can display that message?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如何在 Swing 组件中使用 HTML
显示多行文本
How to Use HTML in Swing Components
Displaying Multi Line Text
你可以这样做
,它会在适当的地方自动包装它。
You can do
and it will automatically wrap it where appropriate.