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

AccesibleContext.getAccessibleIndexInParent is implemented incorrectly in swing

XMLWordPrintable

    • 1.2fcs
    • sparc
    • solaris_2.5.1
    • Verified



      Name: aaC67449 Date: 07/30/98


       
       AccesibleContext.getAccessibleIndexInParent is implemented incorrectly in all subclasses from swing.
       com.sun.java.swing.*.Accessible*.getAccessibleIndexInParent does not return -1 for a component with a nonaccessible parent, but should.

      JavaDoc Says:"
      public abstract int getAccessibleIndexInParent()

          Get the 0-based index of this object in its accessible parent.
          Returns:
              the 0-based index of this object in its parent; -1 if this object does not have an accessible parent.
      "


      ------------------Example-----------------------------------

      import com.sun.java.accessibility.*;
      import com.sun.java.swing.*;
      import java.awt.*;

      public class Test{
          public static void main(String argv[]) {
                Accessible o[]= {new JPanel(),new Box(BoxLayout.X_AXIS),new CellRendererPane()};
      AccessibleContext c;
                Panel parent=new Panel();
                for(int i=0;i<o.length;i++) {
      parent.add((Component)o[i]);
      c=o[i].getAccessibleContext();
                    if(c.getAccessibleIndexInParent()!=-1)
      System.out.println("Failed: method does not return -1 for "+(Object)o[i]);
                    else
      System.out.println("OKAY");

      }
          }
      }

      -------------------Output------------------------------------
      Failed: method does not return -1 for com.sun.java.swing.JPanel[,0,0,0x0,invalid,layout=java.awt.FlowLayout]
      Failed: method does not return -1 for com.sun.java.swing.Box[,0,0,0x0,invalid,layout=com.sun.java.swing.BoxLayout]
      Failed: method does not return -1 for com.sun.java.swing.CellRendererPane[,0,0,0x0,invalid,hidden]
       

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

            pkorn Peter Korn (Inactive)
            aalievsunw Artem Aliev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: