I tried this myself and it worked for me. What is the problem you are running
into?
On Apr 6, 2011, at 4:14 PM, Luís Eduardo wrote:
>
>
> Thanks Greg. It worked. (more or less)
>
>
>
> Em 06/04/2011 15:59, Greg Brown escreveu:
>> 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);
>>> }
>>
>