The background
I'm a legally deafblind developer in C#, Java, PHP, JavaScript and some other languages and libraries. I consider myself a pretty advanced hobby developer and will soon start to study computer sciences.
I know we'll focus on Java as programming language, hence I decided to pick up some of my old projects. Console applications have no real appeal to me anymore - I've done most things there. So I usually end up creating GUIs. Using PHP and HTML, that's very easy, and in C# not too hard, either. Sure, I need help with visual aspects; but I can get a solid GUI up and running on Windows using C# both in WindowsForms and WPF framework. Accessibility has rarely been an issue there.
Ironically, Java was both my first attempt in GUI creation and the only language in which I never got it to work properly.
My problem
Let's keep this simple: All I want to do is create a basic message dialog named Test
with the text Hello world
in it. Let's have a look at it.
import javax.swing.JOptionPane;
public class GUITest {
public static void main(String[] args) {
JOptionPane.showMessageDialog(null, "Hello world!", "Test", JOptionPane.INFORMATION_MESSAGE);
}
}
This isn't rocket science; JavaScript's alert
function and the MessageBox
of C# do similar things. Usually when such a message dialog pops up my braille display is focused on an OK or Close button, the screen reader announces the dialog title and message, and I can also perceive the static text of the dialog using scrolling via my braille display keys and/or the touch cursor (JAWS) and/or the respective special cursors of the screen reader like JAWS cursor or NVDA cursor, which is the mouse pointer and can get moved all over the screen, so obviously eventually lands on the static text.
But what happens in Java?
- Under JAWS, a Test Dialog opens. I see no message, just the dialog title and if I use the touch cursor I also see a Close button.
- Under NVDA, it's the same as under JAWs, except focus doesn't move automatically and I can't see the close button.
- Narrator moves the focus automatically also, but just like NVDA does not perceive the close button.
I use Java SDK 11, the latest Eclipse version, and Windows 10; NVDA version 18.3 and the latest JAWS 19 version. My software is pretty up to date, and at least in JAWS I'm an expert user who knows most, if not all, methods to get static text. None of these methods worked.
The question
Does anyone happen to know how Java accessibility works? I know accessible Java applications exist; I just have no clue how to create them. My problem with the dialogs is just the most basic of problems - more complex GUIs with JFrames, buttons, text fields etc. are just as inaccessible. And that although Oracle basically says as long as you leave our components alone and maybe give accessible names and descriptions they're accessible out of the box.
Any input which might explain what I'm missing would be much appreciated.
Further research
javax.swing
I installed NetBeans on my computer. No, to be precise, I installed the installer of NetBeans on my computer. The installer is... inaccessible. That in itself isn't unusual - surprisingly, many developers who put lots of thought into creating an accessible application then create inaccessible installers. Hence I stick to ZIPs and manual configuration as often as I can (you know, not everything was worse in the 2000s, and I'm actually glad there are purists and/or control freaks out there who despise installers).
But the really interesting thing is: The NetBeans installer looks just like my inaccessible dialogs and other GUIs I created with javax.swing. That is: blank (except for the dialog/window name) for NVDA and Narrator, and with JAWS I can additionally detect the context menu and a close button if I use the touch cursor. Hooray, I got an entire button to interact with! -- Just that it doesn't even respond to me clicking on it with enter or space bar (didn't try mouse click, as I can't find this close button using JAWS cursor (aka the mouse)).
I'll keep researching. But if this installer is written in javax.swing, and if NetBeans is written in javax.swing also, then it doesn't look good for javax.swing's overall accessibility (for the blind). Also, I'll try to reach out to Oracle. After all, there must be a good reason they put "accessibility is available by default" in their doc about javax.swing and suggested testing with NVDA. Surely I'm just missing the obvious accessibility they implemented -- after all, I only used screen readers for twelve years.
PS. Sorry for the sarcasm, but this situation equally amuses and frustrates me. After all, a company says their GUI classes are accessible by default, and my experience as a deafblind user and developer tells me they're not.
Standard Widget Toolkit (SWT)
Just as suggested in the comments (thanks, VGR), SWT is indeed accessible, at least the base classes. This is not surprising given it uses native widgets when possible -- still, good to know.