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

MoleculeSampleApp source code in JavaFX tutorial is broken

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P4 P4
    • None
    • 8u45
    • docs
    • x86_64
    • windows_7

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

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.1.7601]

      A DESCRIPTION OF THE PROBLEM :
      The sample code in "Building a 3D Sample Application" (chapter 8 of the Working with JavaFX Graphics tutorial at https://docs.oracle.com/javase/8/javafx/graphics-tutorial/sampleapp3d.htm) will not compile and in general will not work even when obvious bugs are fixed.

      NOTE: The code in the MoleculeSampleApp.zip file is fine. It is the code as presented inline with the tutorial text and in Appendix B (https://docs.oracle.com/javase/8/javafx/graphics-tutorial/sampleapp3d-code.htm) that is broken. The tutorial example code does *not* match what is in the downloadable archive.

      Main problems (not exhaustive, potentially):

      1. The 'world' Xform instance variable is never added to the scene root. As a result, the stage will be blank. For example, if you work through the tutorial up to and including "Build the Axes" step 6, you'll see that the screenshot in Figure 8-1 is incorrect -- no axes are visible.

      2. The buildMolecule() method in Appendix B (https://docs.oracle.com/javase/8/javafx/graphics-tutorial/sampleapp3d-code.htm#CJAJCEHH) does not compile, because the bond2Cylinder variable is used before it is declared, and the bond1Cylinder variable is declared twice. These are obviously typos -- s/2/1/ and s/1/2/, respectively. It doesn't look like this code was tested.

      3. The handleMouse() method in Appendix B (https://docs.oracle.com/javase/8/javafx/graphics-tutorial/sampleapp3d-code.htm#CJAFJADF) does not compile, because the modifierFactor variable is used but never declared.





      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Work through the tutorial chapter https://docs.oracle.com/javase/8/javafx/graphics-tutorial/sampleapp3d.htm, using the code as provided in the tutorial chapter text and the referenced Appendix. To repeat, the .zip code is just fine. It's the code in the tutorial that is broken.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      I expected the sample application to compile and display a molecule.
      ACTUAL -
      Code does not compile, and even once it is fixed to compile, it displays only a blank screen (because the 'world' Xform is never added to the scene root, as I mentioned before).

      REPRODUCIBILITY :
      This bug can be reproduced always.

      CUSTOMER SUBMITTED WORKAROUND :
      Download the MoleculeSampleApp.zip file, and ignore the code in the tutorial.

            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: