Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

import java.awt.Container;
import java.awt.Frame;

public class Main {
    public static Frame getParentFrame(Container container) {
        Container parent = container.getParent();

        while ((parent != null) && !(parent instanceof Frame)) {
            parent = parent.getParent();
        }

        return (Frame) parent;
    }
}