Making Java programs accessible for visually impaired users

Discussion in 'Java' started by Ross, Aug 12, 2011.

  1. Ross

    Ross Guest

    I'm rather confused about the very varied information on the web about
    how to make Swing applications accessible for visually impaired users.
    I've found this page which describes it as being easy and
    straightforward, and gives some examples. http://www.erigena.com/resources/articles/accessible-java/

    I've extended that program to produce a new example, see below. This
    is my first attempt at even a one-pager in terms of accessibility.

    The program I would like to make accessible includes a small number of
    custom GUI widgets, so I'd need to implement various interfaces. But,
    I've found this as an example: http://www-03.ibm.com/able/guidelines/java/snsjavagcustom.html

    Is there a current "best practice" or best choice of tools which could
    be used to make a Java application accessible?




    import java.awt.*;
    import javax.swing.*;
    import javax.accessibility.*;
    import java.awt.event.*;

    public class AccessTest extends JFrame
    {
    private JList content;

    public AccessTest()
    {
    setLayout( new BorderLayout() );
    JMenu file = new JMenu( "File" );
    file.setMnemonic( 'F' );

    AccessibleContext context = file.getAccessibleContext();
    context.setAccessibleName( "File Menu" );
    context.setAccessibleDescription( "Menu for loading and saving
    files" );

    JMenuItem quit = new JMenuItem( "Quit" );
    quit.setMnemonic( 'Q' );
    quit.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q,
    Event.CTRL_MASK));

    context = quit.getAccessibleContext();
    context.setAccessibleName( "Quit" );
    context.setAccessibleDescription( "Quit Option" );

    file.add( quit );
    quit.addActionListener(
    new ActionListener()
    {
    public void actionPerformed( ActionEvent aent )
    {
    goQuit();
    }
    }
    );

    JMenuBar jmb = new JMenuBar();
    context = jmb.getAccessibleContext();
    context.setAccessibleName( "Menu Bar" );
    context.setAccessibleDescription( "The main menu bar" );
    setJMenuBar( jmb );

    jmb.add( file );

    DefaultListModel dlm = new DefaultListModel();
    content = new JList();

    for ( int index = 0; index < 100; index++ )
    {
    dlm.addElement( "Item Number " + (index+1) );
    }

    content.setModel( dlm );

    context = content.getAccessibleContext();
    context.setAccessibleName( "Content" );
    context.setAccessibleDescription( "List of options to choose
    from" );

    add( new JScrollPane( content ), BorderLayout.CENTER );

    JPanel bottomPanel = new JPanel( new FlowLayout() );
    context = content.getAccessibleContext();
    context.setAccessibleName( "Items List" );
    context.setAccessibleDescription( "Bottom panel with selection
    buttons" );

    JButton delete = new JButton( "Delete" );
    delete.setMnemonic( 'D' );

    delete.addActionListener(
    new ActionListener()
    {
    public void actionPerformed( ActionEvent aent )
    {
    goDelete();
    }
    }
    );

    bottomPanel.add( delete );

    JButton create = new JButton( "Create" );
    create.setMnemonic( 'C' );
    create.addActionListener(
    new ActionListener()
    {
    public void actionPerformed( ActionEvent aent )
    {
    goCreate();
    }
    }
    );

    bottomPanel.add( create );

    add( bottomPanel, BorderLayout.SOUTH );

    setBounds( 200, 200, 200, 200 );
    setTitle( "Test frame for accessibility" );

    context = getAccessibleContext();
    context.setAccessibleName( "Test Frame" );
    context.setAccessibleDescription( "Test frame for some basic
    experiments with the Java accessibility framework" );

    addWindowListener(
    new WindowAdapter()
    {
    public void windowClosing( WindowEvent went )
    {
    goQuit();
    }
    }
    );
    }

    private void goQuit()
    {
    System.exit( 0 );
    }

    public static void main( String args[] )
    {
    AccessTest at = new AccessTest();
    at.setVisible( true );
    }

    private void goDelete()
    {
    JOptionPane.showMessageDialog( this, "The delete option was
    selected", "Delete Selected",
    JOptionPane.INFORMATION_MESSAGE );
    }

    private void goCreate()
    {
    JOptionPane.showMessageDialog( this, "The create option was
    selected", "Create Selected",
    JOptionPane.INFORMATION_MESSAGE );
    }
    }
    Ross, Aug 12, 2011
    #1
    1. Advertising

  2. Ross

    Stefan Ram Guest

    Ross <> writes:
    >Is there a current "best practice" or best choice of tools which could
    >be used to make a Java application accessible?


    Having several visually impaired test users? (Not after but during
    development.)

    (Sorry, I lack the »tool thinking«.)
    Stefan Ram, Aug 12, 2011
    #2
    1. Advertising

  3. Ross

    Ross Guest

    On Aug 12, 4:12 pm, -berlin.de (Stefan Ram) wrote:
    > Ross <> writes:
    > >Is there a current "best practice" or best choice of tools which could
    > >be used to make a Java application accessible?

    >
    >   Having several visually impaired test users? (Not after but during
    >   development.)
    >
    >   (Sorry, I lack the »tool thinking«.)


    I am talking to two visually impaired people who are giving me
    feedback and ideas.

    So far it looks as if Java, even with the Java Access Bridge, is a bit
    of a nightmare.
    Ross, Aug 12, 2011
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. darrel

    Making DropDownLists accessible

    darrel, Apr 26, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    517
    darrel
    Apr 27, 2004
  2. Sara rafiee
    Replies:
    3
    Views:
    1,039
    Scott Allen
    Oct 4, 2004
  3. Sharon

    CSS & Visually Impaired

    Sharon, Feb 22, 2004, in forum: HTML
    Replies:
    6
    Views:
    991
    Andy Dingley
    Feb 24, 2004
  4. Michael Chermside

    Needed: Python IDE for the visually impaired

    Michael Chermside, May 6, 2004, in forum: Python
    Replies:
    1
    Views:
    504
    Neil Hodgson
    May 8, 2004
  5. Sara rafiee

    Help me in making users/deleting users in active directory

    Sara rafiee, Oct 3, 2004, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    373
    Robert Koritnik
    Oct 4, 2004
Loading...

Share This Page