private void addMenuItem ( final WComponent parent , final String text , final WText selectedMenuText ) { WMenuItem menuItem = new WMenuItem ( text , new ExampleMenuAction ( selectedMenuText ) ) ; menuItem . setActionObject ( text ) ; if ( parent instanceof WSubMenu ) { ( ( WSubMenu ) parent ) . add ( menuItem ) ; } else { ( ( WMenuItemGroup ) parent ) . add ( menuItem ) ; } }
Adds an example menu item with the given text and an example action to the a parent component .