views:

77

answers:

1

I've noticed that on some macs the JMenuItem uses the word "space" to indicate that the space bar is the key binding. On other macs a symbol is used (looks like a short capital U). I'd prefer the "space" presentation since it's more transparent to users. Is there any way to override how the LAF graphically represents the accelerator key?

+1  A: 

You can subclass BasicMenuItemUI and override the paintMenuItem() method. There you can draw your own accelerator. I would love a animated image as accelerator :)

(Note If you simply want to change the mneonic or accelerator then you can directly use setAccelerator() or other set methods. But I am assuming this is not the case.)

Suraj Chandran
this sounds good! wouldn't I need to subclass Aqua's special BasicMenuItemUI?I think I'm going to give up on this goal, because painting the menu item myself might not be portable between releases of Aqua and the Mac JVM. I'd do my best to mimic the menu item appearance on my computer, and then in a old/future release, or a different computer, the menu items would look different and my imitation would be off. Think that's a valid concern?
Yuvi Masory
1) Yes, if my app is targetted towards Windows, then I would have to override WindowsMenuItemUI. 2) There's a possibility.
Suraj Chandran