Here you can find the source of setComponentEnabled(JComponent component, Boolean isEnabled)
public static void setComponentEnabled(JComponent component, Boolean isEnabled)
//package com.java2s; //License from project: Open Source License import javax.swing.*; import java.awt.*; public class Main { public static void setComponentEnabled(JComponent component, Boolean isEnabled) { if (component == null) return; component.setEnabled(isEnabled); Component[] components = component.getComponents(); for (Component component1 : components) { if (component1 instanceof JComponent) { setComponentEnabled((JComponent) component1, isEnabled); }//w w w . j ava 2 s .c om } } }