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

JScrollpane scrolls JTree to the left after expanding hiding root node dot

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 1.2.0
    • 1.2.0
    • client-libs
    • swing1.1
    • sparc
    • solaris_2.6
    • Verified

      The JScrollpane that the JTree is in scrolls JTree to the left after expanding hiding the root node dot. This occurs with JDK1.1.6 and swing-1.0.2 on Solaris 2.6.

      Steps to Reproduce:
      0) Run the code below with the configuration above.
      1) Note the very first view of the tree.
      2) Collapse the tree.
      3) Expand the tree.
      RESULT: The expanded tree looks different than it orignally did. The scrollpane has scrolled the root's dot to the left and its not visible.

      import com.sun.java.swing.*;
      import java.awt.*;
      import java.awt.event.*;

      public class jtreeroot extends JApplet {
              public void init() {
                      Container contentPane = getContentPane();
                      Object[] objectsForNodes = new Object[] {
                              new JLabel("foo"), "bar"
                      };
                      JTree tree = new JTree(objectsForNodes);
                      JScrollPane scrollPane = new JScrollPane(tree);

                      scrollPane.setPreferredSize(new Dimension(150,100));

                      tree.setRootVisible(true);

                      contentPane.setLayout(new FlowLayout());
                      contentPane.add(scrollPane);
              }
      }

            svioletsunw Scott Violet (Inactive)
            nschorrsunw Nancy Schorr (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: