Java JFrame Parent getParentFrame(Component component)

Here you can find the source of getParentFrame(Component component)

Description

get Parent Frame

License

Apache License

Declaration

public static JFrame getParentFrame(Component component) 

Method Source Code

//package com.java2s;
/*//from  w  w  w . j a  v a2s.  c  o  m
 * codjo.net
 *
 * Common Apache License 2.0
 */

import java.awt.Component;
import java.awt.Container;

import javax.swing.JFrame;

public class Main {
    public static JFrame getParentFrame(Component component) {
        Container container = component.getParent();
        if (container instanceof JFrame || container == null) {
            return (JFrame) container;
        } else {
            return getParentFrame(container);
        }
    }
}

Related

  1. getFrame(Component parent)
  2. getFrameParent(Component component)
  3. getInstalledOperation(final RootPaneContainer frame, final Object actionKey, boolean selfOnly)
  4. getParentalFrame(Component n)
  5. getParentFrame(Component component)
  6. getParentFrame(Component parent)
  7. getParentFrame(Component source)
  8. getParentFrame(Frame[] parentFrames)
  9. getParentFrame(JComponent c)