在 java netbeans ide 中的 jframe 中设置背景图像的函数
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3836482/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
function to set background image in a jframe in java netbeans ide
提问by user463504
I am making a java application using netbeans ide 6.8. I don't the function to set a background image to my jframe. I will be very helpful if you can post the specific coding.
我正在使用 netbeans ide 6.8 制作一个 java 应用程序。我没有为我的 jframe 设置背景图像的功能。如果您可以发布特定的编码,我将非常有帮助。
回答by camickr
There is not function to do this. You need custom code. Background Panelhas a couple of suggestions depending on your requirements.
没有执行此操作的功能。您需要自定义代码。背景面板根据您的要求提供了一些建议。
回答by Taylor
There isn't a function to do that, you have to set a JLabel with your icon property set to the picture and set it to the length and width of the JFrame and set the JFrame's layout property value to null. Then just change the order of the buttons/Labels and what have you so that the background is in fact, in the back. For a more detailed solution to the particular problem, go to http://www.netbeanstutorials.com/p/setting-background-image.htmlThere's even a video how to do it there. I know I was specific but to a newbie it can be overwhelming.
没有一个函数可以做到这一点,你必须设置一个 JLabel,你的图标属性设置为图片,并将其设置为 JFrame 的长度和宽度,并将 JFrame 的布局属性值设置为 null。然后只需更改按钮/标签的顺序以及您拥有的内容,以便背景实际上在后面。有关特定问题的更详细的解决方案,请访问http://www.netbeanstutorials.com/p/setting-background-image.html那里甚至还有如何操作的视频。我知道我很具体,但对于新手来说可能会让人不知所措。

