Swing is a weak GUI technology related to Java accessibility compared to SWT anyway. There are a few things you can try.
First of all, make sure that all availability fields (which you started) are set. I canβt remember if Java has an AccessibleRole field, but you can try setting this in the menu and menuitem for your menu items.
Another thing you can try is the AccessibleMenu component of JMenu.AccessibleJMenu. This is a product of further reading, so I can not verify it from experience. But this and its surrounding classes can satisfy your needs.
If these functions do not work, you can try to use the ability to directly communicate with screen readers. Quentin C has a good library to do this, universal speech . I am new to this library, but it has a Java implementation that should show you how to use it in a Java program. Normally, I would not recommend this approach unless access to the user interface is working.
The final option is to use SWT components instead of Swing, even if this is only for your menu bar. I was not sure how much you would like to be on this, but this is an option and should solve it.
I hope one of these suggestions helps you solve your problem.
source share