开发者

Get Icon Image from the Title Bar of the JFrame

开发者 https://www.devze.com 2022-12-20 00:18 出处:网络
I m using Netbeans IDE, I need to get the icon from the title bar of the JFrame and set it in the JButton. Is there any way to get the Icon ima开发者_如何学Goge from the JFrame, there is no getIconIma

I m using Netbeans IDE, I need to get the icon from the title bar of the JFrame and set it in the JButton. Is there any way to get the Icon ima开发者_如何学Goge from the JFrame, there is no getIconImage() method i tried getIconImages() but it doesnt works.


Frame (the superclass of JFrame) has Frame.getIconImage. You should be able to use that.


Image image =Toolkit.getDefaultToolkit().getImage(getClass().getResource("/resources/agfa_icon.jpg"));
setIconImage(image);

Credit: Alain Demortier, here

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号