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

Win L&F: Focus cursor doesn't dim on JTree nodes when tree loses focus with Win

XMLWordPrintable

      Name: rmT116609 Date: 05/08/2003


      FULL PRODUCT VERSION :
      java version "1.4.2-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-beta-b19)
      Java HotSpot(TM) Client VM (build 1.4.2-beta-b19, mixed mode)

      FULL OS VERSION :
      Microsoft Windows XP [Version 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      On Windows XP when a tree component loses focus the currently focused/selected item background color changes (to a subdued gray). It is no longer the selection/focus color.

      The XP L&F in 1.4.2 beta 1 does not duplicate this behaviour.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      run the attached program - click on itmes in the tree then click away from the app to remove focus. Compare what you see to a tree view on Windows XP (e.g. Windows Explorer's filesystem tree view)



      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      highlighed node should repaint to indicate that the tree is no longer the focused component
      ACTUAL -
      You can't tell that the tree has lost the focus

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.BorderLayout;

      import javax.swing.JFrame;
      import javax.swing.JScrollPane;
      import javax.swing.JTree;
      import javax.swing.tree.DefaultMutableTreeNode;
      import javax.swing.UIManager;

      public class Test extends JFrame
      {
      public static void main(String[] args)
      {
      try
      {
      UIManager.setLookAndFeel( UIManager.getSystemLookAndFeelClassName() );
      }
      catch( Exception e )
      {
      System.err.println("Non-fatal error: Could not set native look and feel.");
      }
      new Test().show();
      }

      private Test()
      {
      setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
      DefaultMutableTreeNode node = new DefaultMutableTreeNode("Root");
      node.add( new DefaultMutableTreeNode("Apples"));
      node.add( new DefaultMutableTreeNode("Bananas"));
      node.add( new DefaultMutableTreeNode("Cherries"));
      JTree tree = new JTree( node );
      System.out.println("Tree row count is "+tree.getRowCount());
      getContentPane().add( new JScrollPane(tree), BorderLayout.CENTER );
      pack();
      }
      }


      ---------- END SOURCE ----------
      (Review ID: 185463)
      ======================================================================

            shickeysunw Shannon Hickey (Inactive)
            rmandalasunw Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: