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

JTree.DynamicUtilTreeNode.loadedChildren works wrong

XMLWordPrintable

    • sparc
    • solaris_2.5.1



      Name: sdC67446 Date: 04/27/99


      The field
      protected boolean loadedChildren;
      of class javax.swing.DynamicUtilTreeNode
      is 'true' if class was instantiated with null children and
      method loadChildren() has not been called. The right value is 'false'.

      The doc says:
      --------------------------------------------------
      protected boolean loadedChildren
          Have the children been loaded yet?

      The test demonstrating the bug:
      -----------------Test.java------------------------
      import javax.swing.JTree;

      public class Test extends JTree.DynamicUtilTreeNode {

          public Test(Object value, Object children) {
        super(value, children);
          }
          public boolean getField_loadedChildren() {
              return loadedChildren;
          }
          
          public static void main(String[] args) {
      Test test;

      test = new Test(null, new Object[0]);
              System.out.println("children != null, no loadChildren(): "+
                  test.getField_loadedChildren());

      test = new Test(null, new Object[0]);
              test.loadChildren();
              System.out.println("children != null, loadChildren(): "+
                  test.getField_loadedChildren());
       
      test = new Test(null, null);
              System.out.println("children == null, no loadChildren(): "+
                  test.getField_loadedChildren());
          }
      }

      ---------Output from the test---------------------
      children != null, no loadChildren(): false
      children != null, loadChildren(): true
      children == null, no loadChildren(): true

      --------------------------------------------------
      ======================================================================

            svioletsunw Scott Violet (Inactive)
            dsvsunw Dsv Dsv (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: