Java JComponent Container getRootPaneContainer(Component c)

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

Description

get Root Pane Container

License

Open Source License

Declaration

public static RootPaneContainer getRootPaneContainer(Component c) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2016 Weasis Team and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:/*from w ww  . j  a  v a  2  s  . c  om*/
 *     Nicolas Roduit - initial API and implementation
 *******************************************************************************/

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

import javax.swing.RootPaneContainer;

public class Main {
    public static RootPaneContainer getRootPaneContainer(Component c) {
        if (c instanceof RootPaneContainer) {
            return (RootPaneContainer) c;
        }
        for (Container p = c.getParent(); p != null; p = p.getParent()) {
            if (p instanceof RootPaneContainer) {
                return (RootPaneContainer) p;
            }
        }
        return null;
    }
}

Related

  1. getRootContainer(Component c)
  2. getRootContainer(Component c)
  3. getRootContainer(Component c)
  4. getRootPane(Component cmp)
  5. getRootPane(final Component component)
  6. getRootPaneContainer(Component c)
  7. getRootWindow(Component component)
  8. getStringValue(JComponent component)
  9. getTopAncestor(JComponent start)