Java tutorial
//package com.java2s; import java.awt.Component; import javax.swing.JComponent; public class Main { public static void setJComponentEnabled(JComponent component, boolean enabled) { component.setEnabled(enabled); for (Component c : component.getComponents()) { c.setEnabled(enabled); } } }