private void prepareMenu ( Container menu , Component component , int x , int y ) { int n = menu . getComponentCount ( ) ; for ( int i = 0 ; i < n ; i ++ ) { Component menuComponent = popupMenu . getComponent ( i ) ; if ( menuComponent instanceof JMenu ) { JMenu subMenu = ( JMenu ) menuComponent ; prepareMenu ( subMenu , component , x , y ) ; } if ( menuComponent instanceof AbstractButton ) { AbstractButton abstractButton = ( AbstractButton ) menuComponent ; Action action = abstractButton . getAction ( ) ; if ( action != null && action instanceof LocationBasedAction ) { LocationBasedAction locationBasedAction = ( LocationBasedAction ) action ; locationBasedAction . prepareShow ( component , x , y ) ; } } } }
Prepare the given menu recursively with the given parameters