Java tutorial
//package com.java2s; //License from project: Apache License import java.awt.Component; import java.awt.Window; import javax.swing.SwingUtilities; public class Main { static Window getWindowAncestor(final Component component) { if (component == null) { return null; } else { return SwingUtilities.getWindowAncestor(component); } } }