简体   繁体   中英

Get Icon Image from the Title Bar of the JFrame

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 image 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

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM