Here you can find the source of doDisable(JComponent component)
public static void doDisable(JComponent component)
//package com.java2s; //License from project: Open Source License import javax.swing.JComponent; public class Main { public static void doDisable(JComponent component) { if (component.isEnabled()) component.setEnabled(false); }/* w ww . j a va 2 s .c o m*/ public static void doDisable(JComponent... components) { for (JComponent comp : components) if (comp.isEnabled()) comp.setEnabled(false); } }