I'm using NetBeans 7.1 to code in Java. I have already created a JFrame
filled with some labels, textbox and buttons
. How can I do to import some image (JPG,PNG,etc...)
from my PC into the same JFrame
? On an specific location of the frame.
JLabel
from the pallete to the form icon
property It's normally best that the images reside within the project folder, makes deployment easier in the long run.
确保在添加JLabel时从Swing控件而不是AWT中使用它。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.