Java JComponent Container getRoot(JComponent pchildComponent)

Here you can find the source of getRoot(JComponent pchildComponent)

Description

get Root

License

Open Source License

Declaration

public static JDialog getRoot(JComponent pchildComponent) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.awt.Container;

import javax.swing.JComponent;
import javax.swing.JDialog;

public class Main {
    public static JDialog getRoot(JComponent pchildComponent) {
        Container objParent = pchildComponent.getParent();
        while (objParent != null) {
            objParent = objParent.getParent();
            if (objParent instanceof JDialog) {
                return (JDialog) objParent;
            }//from w ww.ja  v a2s . co m
        }
        return null;
    }
}

Related

  1. getPanelFor(JComponent comp1, JComponent comp2)
  2. getPanelFor(JComponent comp1, JComponent comp2)
  3. getParent(JComponent parent, final int... path)
  4. getParentPanel(JComponent jc)
  5. getRoot(Component comp)
  6. getRootContainer(Component c)
  7. getRootContainer(Component c)
  8. getRootContainer(Component c)
  9. getRootContainer(Component c)