Java JFrame Parent buildParentFrame(Object inp)

Here you can find the source of buildParentFrame(Object inp)

Description

build Parent Frame

License

Apache License

Declaration

public static Frame buildParentFrame(Object inp) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import javax.swing.*;

import java.awt.*;

public class Main {
    public static Frame buildParentFrame(Object inp) {
        if (inp == null)
            return null;
        if (inp instanceof Frame)
            return (Frame) inp;
        if (inp instanceof Component) {
            Component root = SwingUtilities.getRoot((Component) inp);
            if (root != inp)
                return buildParentFrame(root);
            if (root.getParent() != root)
                return buildParentFrame(root.getParent());
        }//from  ww w  .  j  a  v a 2  s. co m
        return null;

    }
}

Related

  1. AllPlatformGetFile(String dialogTitle, File locationIn, final String fileExtension, FileFilter nonMacFileFilter, boolean allowMultipleSelect, JLayeredPane parentFrame)
  2. AllPlatformSaveAs(Frame parentFrame, String dialogTitle, String directory, final String fileExtension, String fractionFileName, FileFilter nonMacFileFilter)
  3. AllPlatformSaveAs(Frame parentFrame, String dialogTitle, String directory, final String fileExtension, String fractionFileName, FileFilter nonMacFileFilter)
  4. centreOverFrame(JInternalFrame win, JInternalFrame parent)
  5. closeFrameWhenEscapePressed(final JRootPane panel, final ActionListener actListener)
  6. createExceptionDialog(Frame parent, String title, Throwable error)
  7. createProgressDialog(Frame parentFrame, String title, JProgressBar progressBar)