In short, the new approach is to use the following classes to handle the Mac OS X About, Preferences, and Quit menu items: I recently learned that Apple has deprecated the approach I’ve used for many years. Update for Mac OS X 10.9 (Mavericks), 10.10 (Yosemite) and newer Using the source code from a Java/Mac application I just created, let's look at how this works. The key behind properly handling the About, Quit, and Preferences menu items and events comes from using Apple's Application and ApplicationAdapter classes. The Mac Application and ApplicationAdapter classes For Java 9 and newer, see my new tutorial, How to enable About, Preferences, and Quit menu items on MacOS and Java 9 and Java 10. UPDATE: The technique shown below works on Java versions prior to Java 10. Fortunately doing this is very simple, and I'll demonstrate that in this "Java on macOS" tutorial. When writing Java GUI code for the macOS platform (formerly Mac OS X), you'll want to properly handle the Mac About, Quit, and Preferences menu items and events.
0 Comments
Leave a Reply. |