[英]Adding images on Java JFrame - Netbeans
I'm using NetBeans 7.1 to code in Java. 我正在使用NetBeans 7.1在Java中进行编码。 I have already created a
JFrame
filled with some labels, textbox and buttons
. 我已经创建了一个
JFrame
,其中填充了一些labels, textbox and buttons
。 How can I do to import some image (JPG,PNG,etc...)
from my PC into the same JFrame
? 如何将PC中的某些图像
(JPG,PNG,etc...)
导入同一JFrame
? On an specific location of the frame. 在框架的特定位置。
JLabel
from the pallete to the form JLabel
从面板添加到表单 icon
property icon
属性旁边的“ ...”按钮 It's normally best that the images reside within the project folder, makes deployment easier in the long run. 通常最好将映像保存在项目文件夹中,从长远来看使部署更容易。
确保在添加JLabel时从Swing控件而不是AWT中使用它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.