You need to add the items to the menu bar's items collection:
mb.getItems().add(iFile);
mb.getItems().add(iHelp);
On Apr 6, 2011, at 2:38 PM, Luís Eduardo wrote:
>
> Hi,
>
> I am struggling with simple menus in Pivot.
> What i need is to programmatic construct the menus.
> What is wrong with this code???
> Although the frame opens, the menu never shows. (grrr)
>
>
> @Override
> public void startup(Display display, Map<String, String> properties)
> throws Exception {
> frame = new Frame();
> frame.setPreferredSize(new Dimensions(800, 600));
>
> MenuBar mb = new MenuBar();
> Item iFile = new Item("File");
> Item iHelp = new Item("Help");
> mb.add(iFile);
> mb.add(iHelp);
> frame.setMenuBar(mb);
> // mb.setShy(false) // dammit
>
> frame.open(display);
> }