Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4529616

AccessibleJTableCell.isShowing() returns false when the cell on the screen

XMLWordPrintable



      Name: asR10047 Date: 11/20/2001


      AccessibleJTableCell.isShowing() returns false when the cell is actually on
      the screen. In the same situation AccessibleJTreeNode's and
      AccessibleJListChild's isShowing() returns true that seems to be correct.

      Example below says it all:

      ------------------ AccessibleJList -----------------
      import javax.swing.*;
      import java.awt.*;
      import javax.accessibility.*;
      import java.lang.reflect.InvocationTargetException;

      public class AccessibleJList {

          public static void main(String[] argv) {
              Object[][] rowData = {
                              { "01", "02", "03", "04", "05", "06", "07", "08" },
                              { "11", "12", "13", "14", "15", "16", "17", "18" },
                              { "21", "22", "23", "24", "25", "26", "27", "28" },
                              { "31", "32", "33", "34", "35", "36", "37", "38" },
                              { "41", "42", "43", "44", "45", "46", "47", "48" },
                              { "51", "52", "53", "54", "55", "56", "57", "58" },
                              { "61", "62", "63", "64", "65", "66", "67", "68" },
                              { "71", "72", "73", "74", "75", "76", "77", "78" } };

              Object[] colNames = { "1", "2", "3", "4", "5", "6", "7", "8" };
              JList list = new JList( colNames);
              JTable table = new JTable( rowData, colNames);

              JFrame f = new JFrame();
              f.setBounds( 100, 100, 300, 300);
              f.getContentPane().setLayout( new FlowLayout());
              f.getContentPane().add( list);
              f.getContentPane().add( table);
              f.pack();
              f.setVisible( true);

              try {
                  for (int i = 0; i < colNames.length; i++) {
                      AccessibleComponent c1 = list.getAccessibleContext().
                              getAccessibleChild(i).getAccessibleContext().
                              getAccessibleComponent();

                      AccessibleComponent c2 = table.getAccessibleContext().
                              getAccessibleChild(i).getAccessibleContext().
                              getAccessibleComponent();

                      System.out.println("JList accessible child " + i + " isShowing " + c1.isShowing() );

                      System.out.println("JTable accessible child " + i + " isShowing " + c2.isShowing() );

                 }

              } finally {
                  f.dispose();
              }
              System.exit(0);
          }
      }
      -------------- Output from the test -----------------
      java full version "1.4.0-rc-b86"
      Compiled...
      JList accessible child 0 isShowing true
      JTable accessible child 0 isShowing false
      JList accessible child 1 isShowing true
      JTable accessible child 1 isShowing false
      JList accessible child 2 isShowing true
      JTable accessible child 2 isShowing false
      JList accessible child 3 isShowing true
      JTable accessible child 3 isShowing false
      JList accessible child 4 isShowing true
      JTable accessible child 4 isShowing false
      JList accessible child 5 isShowing true
      JTable accessible child 5 isShowing false
      JList accessible child 6 isShowing true
      JTable accessible child 6 isShowing false
      JList accessible child 7 isShowing true
      JTable accessible child 7 isShowing false

      ------------------------------------------------------


      So in the same situation isShowing() works differently although
      the specification is the same.

      ======================================================================

            lmonsantsunw Lynn Monsanto (Inactive)
            anssunw Ans Ans (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: