Example usage for javax.swing JComponent getTreeLock

List of usage examples for javax.swing JComponent getTreeLock

Introduction

In this page you can find the example usage for javax.swing JComponent getTreeLock.

Prototype

public final Object getTreeLock() 

Source Link

Document

Gets this component's locking object (the object that owns the thread synchronization monitor) for AWT component-tree and layout operations.

Usage

From source file:Main.java

public static void setEnabled(JComponent component, boolean t) {
    synchronized (component.getTreeLock()) {
        for (Component c : component.getComponents())
            if (c instanceof JComponent)
                setEnabled((JComponent) c, t);
    }/*from www. j  a v a2s .  c o m*/
    component.setEnabled(t);
}