Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

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

public class Main {
    public static Container getTopContainer(Component component, Class<Component> lookupClass) {
        Container parent = component.getParent();
        if (parent.getClass().equals(lookupClass)) {
            return parent;
        } else {
            return getTopContainer(parent, lookupClass);
        }
    }
}