enable Components - Java java.awt

Java examples for java.awt:Component

Description

enable Components

Demo Code


//package com.java2s;
import java.awt.Component;
import java.awt.Container;

public class Main {
    public static void enableComponents(Container container, boolean enable) {
        Component[] components = container.getComponents();
        for (Component component : components) {
            //            System.out.println(component.toString());
            //            System.out.println(component instanceof Container);
            component.setEnabled(enable);
            if (component instanceof Container) {
                enableComponents((Container) component, enable);
            }/*  www.j av  a2  s . c  om*/
        }
    }
}

Related Tutorials