Example usage for java.awt Component setEnabled

List of usage examples for java.awt Component setEnabled

Introduction

In this page you can find the example usage for java.awt Component 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 setRecursivelyEnabled(Component c, boolean b) {
    c.setEnabled(b);
    if (c instanceof Container) {
        for (Component child : ((Container) c).getComponents()) {
            setRecursivelyEnabled(child, b);
        }/*from   w w w  .j av  a2s.  c  o m*/
    }
}

From source file:Main.java

public static void setEnabledWithBackground(Component comp, boolean isEnabled) {
    comp.setEnabled(isEnabled);
    if (isEnabled)
        comp.setBackground(SystemColor.text);
    else//  w w  w  .j  av  a 2 s .c o m
        comp.setBackground(SystemColor.control);
}

From source file:Main.java

public static void enable(Component... components) {
    for (Component component : components) {
        component.setEnabled(true);
    }//ww  w  .  j  av a2 s.c  om
}

From source file:Main.java

public static void disable(Component... components) {
    for (Component component : components) {
        component.setEnabled(false);
    }/*ww w.  j a  v  a 2  s  .  c  o m*/
}

From source file:Main.java

public static void setEnabled(final boolean isEnabled, final Component... components) {
    for (final Component component : components) {
        component.setEnabled(isEnabled);
    }//from   w ww  .  j ava  2  s  . com
}

From source file:Main.java

public static void setJComponentEnabled(JComponent component, boolean enabled) {
    component.setEnabled(enabled);/*from w  w w . j a  v a2s .com*/
    for (Component c : component.getComponents()) {
        c.setEnabled(enabled);
    }
}

From source file:Main.java

public static void enableComponents(boolean enabled, Component... components) {
    for (Component c : components) {
        c.setEnabled(enabled);
    }//  w  w  w . j  a  v a  2  s .c om
}

From source file:Main.java

public static void enableComponents(boolean enabled, Collection<? extends Component> components) {
    for (Component c : components) {
        c.setEnabled(enabled);
    }/* ww  w  .  j av a  2s  .  c o  m*/
}

From source file:Main.java

public static void setEnabledForChildren(final Container container, final boolean bEnabled) {
    for (int i = 0; i < container.getComponentCount(); i++) {
        final Component child = container.getComponent(i);
        child.setEnabled(bEnabled);
    }//from ww w .j a v a2 s  .  c om
}

From source file:Main.java

/** Set the enabled property of the given components.  Intended to reduce clutter in GUI code. */
public static void setEnabled(boolean b, Component... components) {
    for (Component c : components) {
        c.setEnabled(b);
    }//from  ww  w. j  a  v  a 2 s.c  o m
}