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.Window;

import javax.swing.SwingUtilities;

public class Main {
    public static Window getWindowAncestorOrSelf(Component c) {
        if (c instanceof Window) {
            return (Window) c;
        }
        if (c == null) {
            return null;
        }
        return SwingUtilities.getWindowAncestor(c);
    }
}