-
Bug
-
Resolution: Fixed
-
P2
-
1.3.0
-
04
-
x86
-
windows_nt
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2049663 | 1.4.1 | Lynn Monsanto | P2 | Resolved | Fixed | beta |
JDK-2049662 | 1.4.0_01 | Lynn Monsanto | P2 | Resolved | Fixed | 01 |
Name: pa48320 Date: 12/04/2001
Using the following testcase tab into the JTree and then use the up
and down arrows to navigate to different items. Notice that the JTree
is firing active descendant events that are incorrect. The event
that is currently being sent is always sending the last node as the
new node instead of the correct new node.
import javax.accessibility.*;
import java.beans.*;
import javax.swing.*;
import javax.swing.text.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import javax.swing.tree.*;
public class TreeTest extends JPanel implements PropertyChangeListener
{
public static void main(String[] args)
{
TreeTest p = new TreeTest();
JFrame f = new JFrame("Test JTree Accessibilty");
f.getContentPane().setLayout(new BorderLayout());
f.getContentPane().add(BorderLayout.NORTH, p);
f.pack();
f.setVisible(true);
}
public TreeTest() {
setLayout(new BorderLayout());
DefaultMutableTreeNode top = new DefaultMutableTreeNode("Music");
DefaultMutableTreeNode catagory;
DefaultMutableTreeNode composer;
DefaultMutableTreeNode style;
DefaultMutableTreeNode album;
// Classical
catagory = new DefaultMutableTreeNode("Classical");
top.add(catagory);
// Beethoven
catagory.add(composer = new DefaultMutableTreeNode("Beethoven"));
// Brahms
catagory.add(composer = new DefaultMutableTreeNode("Brahms"));
// Mozart
catagory.add(composer = new DefaultMutableTreeNode("Mozart"));
catagory.add(composer = new DefaultMutableTreeNode("Schubert"));
// Jazz
top.add(catagory = new DefaultMutableTreeNode("Jazz"));
// Ayler
catagory.add(composer = new DefaultMutableTreeNode("Albert Ayler"));
// Chet Baker
catagory.add(composer = new DefaultMutableTreeNode("Chet Baker"));
// Coltran
catagory.add(composer = new DefaultMutableTreeNode("John Coltrane"));
// Miles
catagory.add(composer = new DefaultMutableTreeNode("Miles Davis"));
// Rock
top.add(catagory = new DefaultMutableTreeNode("Rock"));
// The Beatles
catagory.add(composer = new DefaultMutableTreeNode("The Beatles"));
// Crowded House
catagory.add(composer = new DefaultMutableTreeNode("Crowded House"));
// Harvin Garvel
catagory.add(composer = new DefaultMutableTreeNode("Harvin Garvel"));
// The Steve Miller Band
catagory.add(composer = new DefaultMutableTreeNode("Steve Miller Band"));
JTree tree = new JTree(top);
add(new JScrollPane(tree), BorderLayout.CENTER);
tree.getAccessibleContext().addPropertyChangeListener(this);
}
public void propertyChange(PropertyChangeEvent e)
{
String name = e.getPropertyName();
if (AccessibleContext.ACCESSIBLE_ACTIVE_DESCENDANT_PROPERTY.equals(name))
{
System.out.println("active descendant changed");
AccessibleContext oldAC = (AccessibleContext)e.getOldValue();
String old = (oldAC == null) ? null : oldAC.getAccessibleName();
System.out.println("old descendant is " + old);
AccessibleContext ac = (AccessibleContext)e.getNewValue();
System.out.println("new descendant is " + ac.getAccessibleName());
}
}
}
(Review ID: 136689)
======================================================================
- backported by
-
JDK-2049662 JTree is sending incorrect active descendant events
- Resolved
-
JDK-2049663 JTree is sending incorrect active descendant events
- Resolved