How to disable Mac / Exit menu items when displaying JDialog?

I have a Swing application that runs on a Mac. When a user opens any JDialog, such as JFileChooser, I want to automatically add "About application", "Exit App_Name" menu items to the Mac menu next to the apple button in the upper left corner of the screen so that it appears disabled, so the user will not be able to click them.

Is it possible?

+4
source share
1 answer

By default, application menu items do nothing when the modal dialog has focus, but the appearance does not change; this is the standard for the Mac OS X interface. Of course, your own native applications should be turned on or off as needed. You can intercept relevant events using the OSXAdapter , as shown in this.

+3
source

Source: https://habr.com/ru/post/1379557/


All Articles