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;

import java.awt.Window;

public class Main {
    public static void parentWindowToFront(Component component) {
        if (component == null) {
            throw new NullPointerException("component == null");
        }
        Container parent = component.getParent();
        while (parent != null) {
            if ((parent instanceof Window)) {
                Window parentWindow = (Window) parent;
                parentWindow.toFront();
                return;
            }
            parent = parent.getParent();
        }
    }
}