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

javafx.scene.layout.StackPane unable to add and remove children element

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • 8u25
    • javafx

      FULL PRODUCT VERSION :
      java version "1.8.0_25"
      Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
      Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)


      ADDITIONAL OS VERSION INFORMATION :
      Darwin Jims-MacBook-Pro-4.local 13.4.0 Darwin Kernel Version 13.4.0: Wed Mar 18 16:20:14 PDT 2015; root:xnu-2422.115.14~1/RELEASE_X86_64 x86_64

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      Netbeans 8.0.2


      A DESCRIPTION OF THE PROBLEM :
      /*
       * To change this license header, choose License Headers in Project Properties.
       * To change this template file, choose Tools | Templates
       * and open the template in the editor.
       */
      package raining;

      import javafx.application.Application;
      import javafx.event.ActionEvent;
      import javafx.event.EventHandler;
      import javafx.scene.Scene;
      import javafx.scene.control.Button;
      import javafx.scene.layout.StackPane;
      import javafx.stage.Stage;
      import javafx.scene.shape.Circle;
      import javafx.scene.shape.Box;
      import javafx.scene.paint.Color;
      import java.util.Calendar;
      /**
       *
       * @author jchen
       */
      public class Raining extends Application {
          
          private double counter = 1000.00;
        
          public void start(Stage primaryStage) {
              Button btn = new Button();
              btn.setText("Say 'Hello World'");
              btn.setOnAction(new EventHandler<ActionEvent>() {
                  
                  @Override
                  public void handle(ActionEvent event) {
                      System.out.println("Hello World!");
                  }
              });
              
              StackPane root = new StackPane();
              root.getChildren().add(btn);
              
              //Arc shape = new Arc(10.00, 5.00, 5.00, 15.00, 45.00, 50.00);
              boolean dropped = false;
              int index = 1;
              while (!dropped)
              {
                  while (index < 5000)
                  {
                      Circle circ = new Circle(5.00, index, 20.00, Color.web("0x000000", 1.00f));
                      root.getChildren().add(circ);
                      index++; //
                      root.getChildren().remove(1);
                  }
                  dropped = true;
              }
              
              Scene scene = new Scene(root, 1000, 800);
              
              primaryStage.setTitle("Hello World!");
              primaryStage.setScene(scene);
              primaryStage.show();
              
          }
          
          /**
           * @param args the command line arguments
           */
          public static void main(String[] args) {
              launch(args);
          }
          
      }


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1.) Power on mac OSX 10.9.5
      2.) Download and install Oracle JDK 1.8
      3.) Adjust user profile to source JAVA_HOME variable
      4.) Download and install Netbeans 8.0.2 or possibly late
      5.) Once Netbeans is open File -> New Project, Under Select Category click on JavaFX
      Under "Projects" select JavaFX Application click on Next and Input the word, Raining; case sensitive
      6.) copy and paste below code, then goto Run -> Clean and Build project

      package raining;

      import javafx.application.Application;
      import javafx.event.ActionEvent;
      import javafx.event.EventHandler;
      import javafx.scene.Scene;
      import javafx.scene.control.Button;
      import javafx.scene.layout.StackPane;
      import javafx.stage.Stage;
      import javafx.scene.shape.Circle;
      import javafx.scene.shape.Box;
      import javafx.scene.paint.Color;
      import java.util.Calendar;
      /**
       *
       * @author jchen
       */
      public class Raining extends Application {
          
          private double counter = 1000.00;
        
          public void start(Stage primaryStage) {
              Button btn = new Button();
              btn.setText("Say 'Hello World'");
              btn.setOnAction(new EventHandler<ActionEvent>() {
                  
                  @Override
                  public void handle(ActionEvent event) {
                      System.out.println("Hello World!");
                  }
              });
              
              StackPane root = new StackPane();
              root.getChildren().add(btn);
              
              boolean dropped = false;
              int index = 1;
              while (!dropped)
              {
                  while (index < 10000)
                  {
                      Circle circ = new Circle(5.00, index, 20.00, Color.web("0x000000", 1.00f));
                      root.getChildren().add(circ);
                      index = index + index*2; //
                      root.getChildren().remove(1);
                      for (int i = 0; i < 10; i++)
                      {
                          System.out.println("slow down to show animation");
                      }
                      System.out.println(index);
                  }
                  dropped = true;
              }
              
              Scene scene = new Scene(root, 1000, 800);
              
              primaryStage.setTitle("Hello World!");
              primaryStage.setScene(scene);
              primaryStage.show();
              
          }
          
      }


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      1.) compiler finishes and open a separate window titled "Hello World"

      2.) since all of the code is compiled into a .class and then executed within the applet window. File upon opening of the window the black circle should appear at position (5.00, 1.00). However it does not

      3.) Window opens up and "shows" a button and black circle animating from top of the window towards the bottom of the window
      ACTUAL -
      Black circle does not appear at all. While the System.out.println log shows CenterY location correctly and circle should appear.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      http://resume.basikshapes.com/Raining.tar.gz

      After download goto and unpackage the tarball and unzip into a directory with below:

      #tar -zxvf Raining.tar.gz

      This is where to focus on why circle does not appear.
      root.getChildren().add(circ);
      root.getChildren().remove(1);

      while (!dropped)
              {
                  while (index < 10000)
                  {
                      Circle circ = new Circle(5.00, index, 20.00, Color.web("0x000000", 1.00f));
                      root.getChildren().add(circ);
                      index = index + index*2; //
                      root.getChildren().remove(1);
                      for (int i = 0; i < 10; i++)
                      {
                          System.out.println("slow down to show animation");
                      }
                      System.out.println(index);
                  }
                  dropped = true;
              }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      This is actually a bypass of not having inner methods available, so I don't have any other bypass methods to get an object to animate downward inside of an applet

      SUPPORT :
      YES

            ckyang Chien Yang (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: