Hear text (scrolling screen) when the mouse hovers over a JMenu object in Java / Windows

When using a screen analyzer such as NVDA, I want to hear the menu text when I hover over it. I can hear the text when I press the buttons in the menu bar, but not when I hover over them (the on-screen reader reads the menu of other programs only when it is hung over the buttons).

I set the AccessibleContext as shown below:

JMenu.getAccessibleContext().setAccessibleName("text"); JMenu.getAccessibleContext().setAccessibleDescription("more text"); 

I can install listeners on objects that detect when a mouse hangs over them, but I don’t know if / how I can impose text on reading the firmware. I tried ToolTipText , but this text is also not readable by firmware. RequestFocus on JMenu works, but setting focus on an object that just hangs over it with the mouse causes other problems.

Does anyone know how I can let the reader read JMenu text when I hover over the menu bar?

I use Java6 EE and Java AccesBridge (version 2.02) on a Windows computer (XP and w7).

+4
source share
1 answer

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.

+1
source

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


All Articles