简体   繁体   English

如何让 NVDA 读取 Swing/GUI 元素

[英]How to let NVDA read Swing / GUI elements

I am using the Eclipse ide for Java development.我正在使用 Eclipse ide 进行 Java 开发。 When I execute the following code, the NVDA only reads 'This is a frame'.当我执行以下代码时,NVDA 只读取“这是一个框架”。 It doesn't read the button.它不读取按钮。

import javax.swing.导入 javax.swing。 ; ; import javax.accessibility.导入 javax.accessibility。 ; ;

public class MyButton {
    public static void main(String [] args) {
        JFrame f = new JFrame ("This is a frame");
JButton b = new JButton ("This one is a button");
    b.setBounds(50,100,95,30);
//f.add(b);
f.setSize(400,400);
f.setLayout(null);
f.setVisible(true);
b.setToolTipText("This tooltip makes the button accessible");;
}
}

**I have enabled AccessBridge via Ease of Access Center. **我已通过轻松访问中心启用了 AccessBridge。 I'm using Eclipse and NVDA on Windows 10.我在 Windows 10 上使用 Eclipse 和 NVDA。

Normally, it should work.通常,它应该可以工作。 You can try the following things:您可以尝试以下操作:

  • Make sure the access bridge is enabled确保接入网桥已启用
  • restart NVDA and your app, or even reboot, after having installed and enabled access bridge安装并启用访问桥后,重新启动 NVDA 和您的应用程序,甚至重新启动
  • If you are on a 64 bit system, try both 32 and 64 bit JVM.如果您使用的是 64 位系统,请同时尝试 32 位和 64 位 JVM。 Only one of the two may work.两者中只有一个可能有效。
  • Make sure that the focus indeed goes to the button and don't stay on the framm.确保焦点确实在按钮上,不要停留在框架上。 The focus can be in an half-dead position where you can't read anyhting and where tab does nothing.焦点可能处于半死状态,您无法阅读任何内容并且选项卡什么也不做。
  • Java 8: check that jre\\lib\\accessibility.properties contains a line like assistive_technologies=com.sun.java.accessibility.AccessBridge . Java 8:检查jre\\lib\\accessibility.properties包含类似assistive_technologies=com.sun.java.accessibility.AccessBridge I don't know if something similar still exists for Java 11+.我不知道 Java 11+ 是否仍然存在类似的东西。

Note that Swing and access bridge are old and kind of deprecated.请注意,Swing 和 access bridge 已经过时且已被弃用。 For newer projects, you should use another GUI library.对于较新的项目,您应该使用另一个 GUI 库。 To make accessible GUI, you can for example use SWT instead.要制作可访问的 GUI,您可以例如使用 SWT。

Due to a long list of issues, I ended up switching to Eclipse for Java EE.由于一长串问题,我最终切换到 Eclipse for Java EE。 I also updated my NVDA at around the same time.我也大约在同一时间更新了我的 NVDA。 According to the What's New section of the update, they've done some improvements on Java AccessBridge.根据更新的 What's New 部分,他们对 Java AccessBridge 做了一些改进。 I'm not sure if it was the NVDA update or switching to Java EE, but everything is working as it should.我不确定是 NVDA 更新还是切换到 Java EE,但一切正常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM