Here you can find the source of findRootPaneContainer(final Component source)
Parameter | Description |
---|---|
source | Component to start with. |
public static RootPaneContainer findRootPaneContainer(final Component source)
//package com.java2s; /**//from w ww . ja v a2s .c o m * Copyright (C) 2009 Future Invent Informationsmanagement GmbH. All rights * reserved. <http://www.fuin.org/> * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 3 of the License, or (at your option) any * later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. * * You should have received a copy of the GNU Lesser General Public License * along with this library. If not, see <http://www.gnu.org/licenses/>. */ import java.awt.Component; import javax.swing.RootPaneContainer; public class Main { /** * Find the root pane container in the current hierarchy. * * @param source * Component to start with. * * @return Root pane container or NULL if it cannot be found. */ public static RootPaneContainer findRootPaneContainer(final Component source) { Component comp = source; while ((comp != null) && !(comp instanceof RootPaneContainer)) { comp = comp.getParent(); } if (comp instanceof RootPaneContainer) { return (RootPaneContainer) comp; } return null; } }