Here you can find the source of getRootWindow(Component component)
public static Window getRootWindow(Component component)
//package com.java2s; //License from project: Open Source License import java.awt.Component; import java.awt.Window; import javax.swing.SwingUtilities; public class Main { /**//from www.j a v a 2s.c o m * get rootwindow for a component */ public static Window getRootWindow(Component component) { Component root = SwingUtilities.getRoot(component); if (root instanceof Window) { return (Window) root; } return null; } }