Chapter 7. Integrating Windows, Menus, and Dialog Boxes

Not too long ago, Apple deprecated and then removed all the Cocoa Java libraries from OS X. A common perception was that Apple was backing away from support of Java development on OS X. This perception is not accurate. A more correct statement is that Apple has streamlined Java on OS X.

Properly written Java applications are still first-class citizens of OS X. The application menu is fully available to Java applications. System events such as quit events are available. Even the Help Viewer is available to Java applications on OS X.

Using Apple's provided libraries, you can create applications that look and feel just like other OS X applications. You can adhere to Apple's Human Interface Guideline when creating your Java applications. Your users need never realize that your application is Java-based and not written in C or Objective-C.

All this OS X integration is available without JNI. At some point, you may desire to venture into the realm of JNI. JNI is the preferred solution for interfacing Java applications with Cocoa or Carbon frameworks in situations where Cocoa or Carbon integration is completely unavoidable. Most applications do not need to go to this extreme. Most common integration tasks are available from the packages com.apple.eio and com.apple.eawt without the need for JNI.

Chapter 8

Get Java® and Mac OS® X now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.