Java tutorial
//package com.java2s; import java.awt.Component; import java.awt.Container; import java.awt.Frame; public class Main { public static Frame getFrameOwner(Component c) { Container parent = c.getParent(); while (parent != null && !(parent instanceof Frame)) { System.out.println("PARENT " + parent); parent = parent.getParent(); } if (parent != null) { return (Frame) parent; } else { return null; } } }