-
Bug
-
Resolution: Fixed
-
P3
-
1.2.2
-
beta
-
sparc
-
solaris_2.5.1
Name: aaC67449 Date: 02/23/99
javax.swing.JTree.AccessibleJTree.AccessibleJTreeNode.getAccessibleIndexInParent() returns incorrect value.
The bug appears in JDK-1.2.2-H.
see example.
-------------------Example-----------------------------------
import javax.swing.*;
import javax.swing.tree.*;
import javax.accessibility.*;
public class Test {
public static void main(String argv[]) {
JTree parent = createTree();
// get parent of tested node
AccessibleContext c = parent.getAccessibleContext().getAccessibleChild(
0).getAccessibleContext();
// get 1 child from parent and then get it index in parent
if(c.getAccessibleChild(1)
.getAccessibleContext().getAccessibleIndexInParent()!=1) {
System.out.println("==========================");
System.out.println("Failed \nreturn "+c.getAccessibleChild(1)
.getAccessibleContext()
.getAccessibleIndexInParent());
} else {
System.out.println("Passed");
}
}
public static JTree createTree() {
DefaultMutableTreeNode root = new DefaultMutableTreeNode(new Integer(0),
true);
JTree tree = new JTree(root);
for (int i=1;i<10;i++)
root.add(new DefaultMutableTreeNode(new Integer(i)));
return tree;
}
}
-------------------Output JDK-1.2.2-H------------------------------------
#>/set/java/JDK1.2.2-H/solaris/bin/java Test
AccessibleJTree created
java.lang.Exception: Stack trace
at java.lang.Thread.dumpStack(Thread.java, Compiled Code)
at javax.swing.JTree$AccessibleJTree.<init>(JTree.java, Compiled Code)
at javax.swing.JTree.getAccessibleContext(JTree.java, Compiled Code)
at Test.main(Test.java, Compiled Code)
==========================
Failed
return 0
----------------- Output JDK-1.2.2-G -----------------
#>/set/java/JDK1.2.2-G/solaris/bin/java Test
Passed
======================================================================