I've encountered two changes in menu behavior when the
apple.laf.useScreenMenuBar property is set to true. I'd like a
little Accumulated Wisdom on what to do about them.
1) menuSelected isn't called the first time when useScreenMenuBar is true.
I've got a menu that implements MenuListener to dynamically create
its contents in the menuSelected method. This works great when
useScreenMenuBar isn't set. When it is, if the menu is selected
right after the associated JFrame is first displayed, before anything
else (any other window, background, etc is clicked), menuSelected
isn't invoked.
It's as if the menu is created in the selected state, and isn't going
to go there until the window first loses focus.
The workaround is to manually setSelected(true);setSelected(false) at
the end of the menu's ctor. Crude, but seems to be effective.
Unfortunately, the reason I want this menu to be dynamic is that it's
expensive to populate, and seldom invoked. Creating it in the ctor
defeats the purpose of a dynamic menu, at least for this one.
Is there any other solution to this?
2) JButton in the JMenu doesn't display
To display a (occasionally changing) icon in the menu bar, I add a
JButton to the JMenu. The JButton has no text, just an icon, though
that doesn't seem to effect the problem. On other platforms, on the
Mac with non-Aqua LAF, and in Aqua when useScreenMenuBar isn't set,
this works. When useScreenMenuBar is set, the JButton just doesn't
display. There _might_ be a couple of pixels of width being reserved
for it or not, its hard to tell. But the icon is clearly not there,
and if I use text instead, it's not there either.
I've found no workaround for this, and would greatly appreciate one.
Even an explanation of why it's happening would be very helpful.
Thanks in advance.
Bob
--
Bob Jacobsen, UC Berkeley
email@hidden +1-510-486-7355 fax +1-510-643-8497 AIM, Skype JacobsenRG
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden