Java JComponent Container getOutermostRootPane(Component c)

Here you can find the source of getOutermostRootPane(Component c)

Description

get Outermost Root Pane

License

Open Source License

Declaration

public static JRootPane getOutermostRootPane(Component c)
        

Method Source Code

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

import java.awt.Component;

import javax.swing.JApplet;

import javax.swing.JDialog;
import javax.swing.JFrame;

import javax.swing.JRootPane;

import javax.swing.JWindow;

import javax.swing.RootPaneContainer;

import javax.swing.SwingUtilities;

public class Main {
    public static JRootPane getOutermostRootPane(Component c)
    /*      */{//from www  .ja v  a 2  s.  c  o m
        /* 3359 */if (((c instanceof RootPaneContainer))
                && (c.getParent() == null)) {
            /* 3360 */return ((RootPaneContainer) c).getRootPane();
            /*      */}
        /*      */
        /* 3363 */for (; c != null; c = SwingUtilities.getRootPane(c)) {
            /* 3364 */if ((c instanceof JRootPane)) {
                /* 3365 */JRootPane lastRootPane = (JRootPane) c;
                /* 3366 */if (c.getParent().getParent() == null) {
                    /* 3367 */return lastRootPane;
                    /*      */}
                /* 3369 */if (((c.getParent() instanceof JDialog))
                        || ((c.getParent() instanceof JWindow))
                        || ((c.getParent() instanceof JFrame))
                        || ((c.getParent() instanceof JApplet)))
                /*      */{
                    /* 3371 */return lastRootPane;
                    /*      */}
                /* 3373 */c = c.getParent().getParent();
                /*      */}
            /*      */}
        /* 3376 */return null;
        /*      */}
}

Related

  1. getLocalInsetBounds(JComponent component)
  2. getMandatoryPanel(JComponent c)
  3. getMaxVisibleY(JComponent comp)
  4. getModelObject(JComponent c)
  5. getOutermostRootPane(Component c)
  6. getPanelFor(JComponent comp1, JComponent comp2)
  7. getPanelFor(JComponent comp1, JComponent comp2)
  8. getParent(JComponent parent, final int... path)
  9. getParentPanel(JComponent jc)