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

Redraw problem with page up/page down for JTree in a JScrollPane

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.2.2
    • client-libs



      Name: krT82822 Date: 08/03/99


      The symptoms can be reproduced easily with
      http://java.sun.com/docs/books/tutorial/uiswing/components/example-swing/TreeDemo.java

      Basically, when a JTree inside a JScrollPane is smaller than the viewport of the scrollpane then PageUp/PageDown keys cause a wierd redraw effect. The JTree appears to be shrunk to its actual size and is moved such its bottom edge touches the bottom edge of the JScrollPane (the gap between the two top edges is also rendered differently - in gray).

      Expanding or shrinking nodes, followed by further PageUp/PageDown keypresses further confuses the positioning of the JTree.

      It can be demonstrated that it's the JScrollPane that's responsible by making the following change to the above example:
      replace:
        //Create the scroll pane and add the tree to it.
        JScrollPane treeView = new JScrollPane(tree);
      with:
        javax.swing.JPanel treeView = new javax.swing.JPanel() ;
        treeView.setLayout( new java.awt.BorderLayout( 0, 0 )) ;
        treeView.add( tree, java.awt.BorderLayout.CENTER ) ;
      The behaviour then goes away.

      This appears to have been introduced in jdk1.2.2 - its not reproducable with jdk1.2.1 (I don't recall noticing it with jdk1.2.2RC1 either).
      (Review ID: 93379)
      ======================================================================

            svioletsunw Scott Violet (Inactive)
            kryansunw Kevin Ryan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: