我有一个简单的 Swing 应用程序,其中 JEditorPane 包装在 JScrollPane 中。
当焦点进入 JEditorPane 时,它只读取可访问的名称,后跟“文本”,然后停止,而预期的行为是继续读取 JEditorPane 的内容。
如果我不将 JEditorPane 包装在 JScrollPane 中,它会按预期工作。
我曾尝试使用 Monkey 检查可访问的树,但我看不到包裹在 JScrollPane 中的 JEditorPane 和未包裹的 JEditorPane 之间的任何相关区别。
有任何想法吗?
这是一个演示问题的简短示例。如果焦点进入第一个 JEditorPane,JAWS 将读取“第一个编辑器窗格 - 编辑”。如果焦点进入第二个 JEditorPane,JAWS 读取“第二个编辑器窗格 - 编辑 - 栏”。
public final class SmallExample {
public static void main(String... aArgs){
JFrame frame = new JFrame("Test Frame");
JPanel panel = new JPanel();
JEditorPane editorPane1 = new JEditorPane();
editorPane1.setText("Foo");
editorPane1.getAccessibleContext().setAccessibleName("first editorpane");
editorPane1.getAccessibleContext().setAccessibleDescription("");
JScrollPane scrollPane = new JScrollPane( editorPane1, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED );
panel.add(scrollPane);
JEditorPane editorPane2 = new JEditorPane();
panel.add(editorPane2);
editorPane2.setText("Bar");
editorPane2.getAccessibleContext().setAccessibleName("second editorpane");
editorPane2.getAccessibleContext().setAccessibleDescription("");
frame.getContentPane().add(panel);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.pack();
frame.setVisible(true);
}
}