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
精彩评论