Java JFrame getParentJFrame(Component c)

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

Description

get Parent J Frame

License

Open Source License

Declaration

public static JFrame getParentJFrame(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  w w.  java  2 s . com*/
 *     Nicolas Roduit - initial API and implementation
 *******************************************************************************/

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

import javax.swing.JFrame;

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

Related

  1. getjFrame(int width, int height)
  2. getJFrame(JPanel panel, String title, int width, int height)
  3. getJFrame(Window window)
  4. getJFrameOfComponent(Component cmpnt)
  5. getModalDlg(JFrame frame, String title)
  6. getParentJFrame(Container theFrame)
  7. getParentJFrame(java.awt.Container component)
  8. getPersistentExtendedStateMask(JFrame frame)
  9. getRootJFrame(Component c)