Example usage for java.awt Container setEnabled

List of usage examples for java.awt Container setEnabled

Introduction

In this page you can find the example usage for java.awt Container setEnabled.

Prototype

public void setEnabled(boolean b) 

Source Link

Document

Enables or disables this component, depending on the value of the parameter b .

Usage

From source file:Main.java

public static void setEnableContainer(Container c, boolean band) {
    Component[] components = c.getComponents();
    c.setEnabled(band);
    for (int i = 0; i < components.length; i++) {
        components[i].setEnabled(band);/*w  w  w  .java2s  .  c  om*/

        if (components[i] instanceof Container) {
            setEnableContainer((Container) components[i], band);
        }
    }
}

From source file:Main.java

public static void enableAll(Container container, boolean flag) {
    if (container == null)
        return;//  w  ww .  ja  va 2 s.  c  o m
    container.setEnabled(flag);
    Component acomponent[] = container.getComponents();
    if (acomponent == null)
        return;
    for (int i = 0; i < acomponent.length; i++)
        if (acomponent[i] instanceof Container)
            enableAll((Container) acomponent[i], flag);
        else
            acomponent[i].setEnabled(flag);

}

From source file:de.innovationgate.utils.WGUtils.java

/**
 * Sets a swing/awt container and all of its child components enabled or
 * disabled//  w  w  w .j  a v a2s  .  c o  m
 * 
 * @param con
 *            The container
 * @param enabled
 *            The state to set. true for enabled. false for disabled
 */
public static void setAllEnabled(Container con, boolean enabled) {

    Component[] children = con.getComponents();
    for (int i = 0; i < children.length; i++) {
        children[i].setEnabled(enabled);
    }
    con.setEnabled(enabled);

}