Here you can find the source of getWindowImage(Window window)
public static Image getWindowImage(Window window)
//package com.java2s; //License from project: Apache License import java.awt.Image; import java.awt.Window; import javax.swing.JDialog; import javax.swing.JFrame; public class Main { public static Image getWindowImage(Window window) { try {//from ww w . ja v a2 s .co m if (window instanceof JFrame) { return ((JFrame) window).getIconImage(); } if (window instanceof JDialog) { return ((JDialog) window).getIconImages().get(0); } } catch (Exception e) { } return null; } }