private boolean managesCommand ( Component component , String commandId ) { if ( component instanceof AbstractButton ) { AbstractButton button = ( AbstractButton ) component ; if ( null != button . getActionCommand ( ) ) { if ( button . getActionCommand ( ) . equals ( commandId ) ) { return true ; } } } else if ( component instanceof Container ) { Component [ ] subComponents = ( ( Container ) component ) . getComponents ( ) ; for ( int i = 0 ; i < subComponents . length ; ++ i ) { if ( managesCommand ( subComponents [ i ] , commandId ) ) { return true ; } } } return false ; }
Searches through the component and nested components in order to see if the command with supplied id exists in this component .