Thursday, February 17, 2011

Using Mac OS X Services-menu from a Java/Swing application

I would like to make my Java/Swing application compatible with the Services-menu available on Mac OS X. For example, so that the user could select some text in JTextArea and have it converted into speech by Services -> Speech -> Start Speaking Text. Is there a simple way to achieve that? (The application should still be able to run on platforms other than Mac OS X.)

From stackoverflow
  • I'm inclined to say no. If I recall correctly, services are only available to Cocoa applications, and Java apps are not Cocoa applications.

  • Have a look at apple's OSXAdapter package (link requires free apple developer login) for java development. The samples included in the package shows you how to integrate nicely to the OS X application menu in a way that is only activated when your application is running under OS X.

  • This seems to work on Mac OS X Leopard, with no change to the original application. So I've lost interest in the answer (to how to make it work on Tiger). Thanks for your contribution, however.

0 comments:

Post a Comment