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

java.awt.Component.AccessibleAWTComponent.getAccessibleAt() wrong doc

XMLWordPrintable

    • Cause Known
    • sparc
    • solaris_2.6

      Name: ksC84122 Date: 03/22/2000


      The kestrel javadoc for java.awt.Component.AccessibleAWTComponent.getAccessibleAt(Point p)
      states:

      "Returns the Accessible child, if one exists, contained at
       the local coordinate Point".
       
      However, for most of swing visible objects(like JFrame), if the child does not exist, the object
      itself is returned. The Javadoc says nothing about that.

      For other invisible objects (like Box.Filler), null is returned.

      The javadoc should clearly state the situations when:

      a. the child is returned
      b. the object itself is returned
      c. null is returned.

      Here is the example demonstrating the bug:
      ------------- test49.java -------------------------

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

      public class test49 {

          public static void main(String[] args) {
              JFrame o = new JFrame();
              o.setSize(50, 50);
              AccessibleComponent c = o.getAccessibleContext().getAccessibleComponent();
              Point p;
              p = new Point(2, 2);
              if (o.equals(c.getAccessibleAt(p))) {
                  System.out.println("JFrame: same object returned");
              }
              
              Box.Filler o1 = new Box.Filler(new Dimension(0, 0),
                      new Dimension(10, 10), new Dimension(1000, 1000));
              c = o1.getAccessibleContext().getAccessibleComponent();
              o1.setSize(50, 50);
          
              if (c.getAccessibleAt(p) == null) {
                   System.out.println("Box.Filler: returns null");
              } else {
                   System.out.println("Box.Filler: returns not null");
              }
              
              return;
          }
      }

      ========= Sample run (JDK1.3) ==========
      #>java test49
      JFrame: same object returned
      Box.Filler: returns null


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

            dav Andrei Dmitriev (Inactive)
            skosunw Sko Sko (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: