This discussion is archived
2 Replies Latest reply: Dec 28, 2007 7:49 AM by 843807 RSS

How to stop reader to react to updates of non-selected components?

843807 Newbie
Currently Being Moderated
I have a table and panel which show detailed information about the selected in the table element.
The table has ListSelectionListener and MouseListener to update the panel on selection change.

If these listeners are removed the accessibility reader (JAWS) works. If they are on every change of the selected row (no problem in changing selected column) in the table causes reading the content of all text fields without the names of text fields (some of them several times). I'm not blind and I needed some time to find what the hell it reads, for a blind customer all this verbiage will be understand as it is the content of the selected table cell.

My question is - is it possible to stop this and to make the reader to read only the selected table cell?
  • 1. I found it
    843807 Newbie
    Currently Being Moderated
    I see nobody has answered, nevertheless if you are interested here is a small example reproducing the problem.
    Most probably this is bug in the java, as the cause is JTextFiels.setEditable(false).

    import javax.swing.*;
    import javax.swing.event.ListSelectionListener;
    import javax.swing.event.ListSelectionEvent;
    import java.awt.*;
    public class TableAccTest extends JPanel implements ListSelectionListener {
      private JTextField text;
      public TableAccTest() {
        JPanel tablePanel = new JPanel( new BorderLayout( 5, 5 ) );
        JTable table = new JTable(
                new Object[][]{ { 1, 1, 1 }, { 2, 2, 2 }, { 3, 3, 3 } },
                new Object[]{ 1, 2, 3 } );
        table.getSelectionModel().addListSelectionListener( this );
        tablePanel.add( table, BorderLayout.CENTER );
        setLayout( new BorderLayout( 5, 5 ) );
        add( tablePanel, BorderLayout.CENTER );
        text = new JTextField();
        text.setEditable( false ); // !!!
        add( text, BorderLayout.SOUTH );
      public void valueChanged( ListSelectionEvent lse ) {
        text.setText( "Why this is read?" );
      public static void main(String[] ss) {
        Frame frame = new Frame( "Accessibilty test" );
        frame.add( new TableAccTest() );
        frame.setSize( 200, 200 );
        frame.setVisible( true );
  • 2. Re: I found it
    843807 Newbie
    Currently Being Moderated
    I just posted a problem similar to this. I've reproduced the problem with the SimpleTableDemo, which does not have a setEditable call. You say that you found the answer to the problem, but did you find a solution?

    I've included my changes to SimpleTableDemo (I'm also having problems with JTabbedPanes crashing when under the reader, but can't get that to reproduce, so I'm not sure that the bug is just Swing/Reader interaction).
            public SimpleTableDemo() {
            super(new GridLayout(1,0));
            String[] columnNames = {"First Name",
                                    "Last Name",
                                    "# of Years",
            Object[][] data = {
                {"Mary", "Campione",
                 "Snowboarding", new Integer(5), new Boolean(false)},
                {"Alison", "Huml",
                 "Rowing", new Integer(3), new Boolean(true)},
                {"Kathy", "Walrath",
                 "Knitting", new Integer(2), new Boolean(false)},
                {"Sharon", "Zakhour",
                 "Speed reading", new Integer(20), new Boolean(true)},
                {"Philip", "Milne",
                 "Pool", new Integer(10), new Boolean(false)}
            final JTable table = new JTable(data, columnNames);
            table.setPreferredScrollableViewportSize(new Dimension(500, 70));
         //   table.setFillsViewportHeight(true);
    //        AccessibleContext ac = table.getAccessibleContext();
    //        ac.setAccessibleName("Demonstration Table");
            if (DEBUG) {
                table.addMouseListener(new MouseAdapter() {
                    public void mouseClicked(MouseEvent e) {
            //Create the scroll pane and add the table to it.
            JScrollPane scrollPane = new JScrollPane(table);
            //Add the scroll pane to this panel.
            JTabbedPane tabs = new JTabbedPane();
            tabs.add("TableDemo", scrollPane);
            JPanel panel2 = new JPanel(new GridLayout(1,0));
            panel2.add(new JLabel("Panel 2"));
            tabs.add("Second", panel2);
    Edited by: AlamoBrian on Dec 28, 2007 7:46 AM