Here you can find the source of getParentalFrame(Component n)
null
if none.
public static Frame getParentalFrame(Component n)
//package com.java2s; import java.awt.Component; import java.awt.Frame; public class Main { /**//from w w w.j a v a2 s . com * Get the Frame a Component is contained in. * <p> * Traverses parents until a Frame is found. * @return the first parent frame or <code>null</code> if none. * @deprecated Use {@link javax.swing.SwingUtilities#getAncestorOfClass(Class, Component) SwingUtilities.getAncestorOfClass(Frame.class, n)} instead. * @see javax.swing.SwingUtilities#getAncestorOfClass(Class, Component) */ public static Frame getParentalFrame(Component n) { while (!(n instanceof Frame) && n != null) n = n.getParent(); return (Frame) n; } }