Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.awt.*;

public class Main {
    public static boolean isComponentVisible(Component comp) {
        if (!comp.isVisible() && !isRootComponent(comp)) {
            return false;
        }
        Component parent = comp.getParent();

        return parent == null || isComponentVisible(parent);

    }

    public static boolean isRootComponent(Component root) {
        Container parent = root.getParent();
        return parent == null;
    }
}