Modifying Popup Menu (from System Tray Icon) with Alt Key


I made an application that mostly lives in the system tray, and on clicking the icon it shows a popup menu.

I was trying to re-create the common macOS behaviour and display some advanced options when the “alt” key is held down, but somehow i couldn’t make my SystemTrayIconComponent to receive any key events.

I implemented the KeyListener interface and registered it with the SystemTrayIconComponent as well as the toplevel component, and tried to acquire keyboard focus, but to no avail.

Is there a way to make a SystemTrayIconComponent receive key press events ?