public static void setEnabled ( Component component , boolean bEnabled ) { if ( component instanceof JPanel ) { for ( int i = 0 ; i < ( ( JPanel ) component ) . getComponentCount ( ) ; i ++ ) { JComponent componentSub = ( JComponent ) ( ( JPanel ) component ) . getComponent ( i ) ; ScreenUtil . setEnabled ( componentSub , bEnabled ) ; } } else if ( component instanceof JScrollPane ) { JComponent componentSub = ( JComponent ) ( ( JScrollPane ) component ) . getViewport ( ) . getView ( ) ; ScreenUtil . setEnabled ( componentSub , bEnabled ) ; } else component . setEnabled ( bEnabled ) ; }
Fake disable a control .