Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-swt-dev] Mac OS X application menu?

I'm pretty new to SWT.  I'm trying to get it to work on Mac OS X in iRATE radio:

http://irate.sourceforge.net/

I followed the instructions in Eclipse bug #40003. It mostly works well. However, Mac OS X adds an extra menu in addition to the ones created by the java app. Apple calls it the Application Menu. In iRATE, the menu has the title "iRATE radio". The menu is not present on other platforms like Windows and Linux.

The problem I have is that the application menu's Quit item doesn't work right. iRATE's window disappears, as do most of its menu titles, but the application menu is still present, and iRATE continues playing its audio (it is an MP3 downloader and player).

You can try out what I have so far, with the broken quit menu, at:

http://irate.sourceforge.net/download.unstable.html#osx-swt

I have found two ways for Java apps to deal with the application menu, but neither works for me. The first, which is deprecated, is to install a com.apple.mrj.MRJQuitHandler:

http://developer.apple.com/qa/qa2001/qa1187.html

the new way is to use the com.apple.eawt.Applicaton singleton, with which I install a com.apple.eawt.ApplicationListener (or rather a class that implements that interface).

If I do either one, iRATE never shows any of its UI. I have to forcibly terminate it. There are no error messages to the console.

I suspected Apple's platform-specific packages might be using AWT, so I followed the instructions at the bottom of bug #40003, and called:

System.setProperty( "java.awt.headless", "true" );

This seemed to verify that Apple was indeed using AWT, in that it allowed iRATE to start up and work. But again the Quit menu didn't work.

Could the application menu actually be created by SWT? If so, what do I need to do to handle it? Or is there something else I need to do.

Mike
--
Michael D. Crawford
GoingWare Inc. - Expert Software Development and Consulting
http://www.goingware.com
crawford@xxxxxxxxxxxxx

  Tilting at Windmills for a Better Tomorrow.

    "I give you this one rule of conduct. Do what you will, but speak
     out always. Be shunned, be hated, be ridiculed, be scared,
     be in doubt, but don't be gagged."
     -- John J. Chapman, "Make a Bonfire of Your Reputations"
        http://www.goingware.com/reputation/



Back to the top