Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/361.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/user-interface/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在Java GUI上添加多行标签?_Java_User Interface_Swing_Jlabel - Fatal编程技术网

如何在Java GUI上添加多行标签?

如何在Java GUI上添加多行标签?,java,user-interface,swing,jlabel,Java,User Interface,Swing,Jlabel,我制作了一个JavaSwingGUI。现在我想在上面显示一条静态消息,但是消息是多行的,而JLabel是单行的 如何显示该消息 我们是否可以设置JLabel的任何属性来显示多行消息 我需要为多行使用多个JLabel吗 有没有其他方式可以显示该消息? 你可以做 JLabel l = new JLabel("<html><p>Hello World! blah blah blah</p></html>"); JLabel=newjlabel(“hel

我制作了一个JavaSwingGUI。现在我想在上面显示一条静态消息,但是消息是多行的,而JLabel是单行的

如何显示该消息

我们是否可以设置JLabel的任何属性来显示多行消息

我需要为多行使用多个JLabel吗

有没有其他方式可以显示该消息?

你可以做

JLabel l = new JLabel("<html><p>Hello World! blah blah blah</p></html>");
JLabel=newjlabel(“helloworld!诸如此类诸如此类”

”;
它会在适当的地方自动将其包装。