I am trying to set the icon that appears in the top-left corner of a frame as a custom image with .gif extension, instead of the default java icon. I tried using :
setIconImage(Toolkit.getDefaultToolkit().getImage("/jlab/mainframe/images/jLab.gif"));
However, whenever I run the application, the default java icon still appears. Can image of any size be used as an icon? if yes then kindly resolve my problem. Thanks in advance.
试试这个(它将在类路径中查找):
setIconImage(Toolkit.getDefaultToolkit().getImage(this.getClass().getResource("/jlab/mainframe/images/jLab.gif")));
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.