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

[FX3D]PhongMaterial: method toString() throws StackOverflowError.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 8
    • javafx
    • fx3d b194 amd64, win7

      Run this code and press any key.

      import javafx.application.Application;
      import javafx.event.EventHandler;
      import javafx.scene.Group;
      import javafx.scene.PerspectiveCamera;
      import javafx.scene.PointLight;
      import javafx.scene.Scene;
      import javafx.scene.input.KeyEvent;
      import javafx.scene.paint.Color;
      import javafx.scene.paint.PhongMaterial;
      import javafx.scene.shape.Sphere;
      import javafx.stage.Stage;

      public class PhongMaterialToString extends Application {
          
          PhongMaterial pm;
          
          @Override
          public void start(Stage stage) throws Exception {
              pm = new PhongMaterial();
              pm.setDiffuseColor(Color.LIGHTGRAY);
              pm.setSpecularColor(Color.rgb(30, 30, 30));
              Sphere sphere = new Sphere();
              sphere.setMaterial(pm);
              sphere.setScaleX(100);
              sphere.setScaleY(100);
              sphere.setScaleZ(100);
              PointLight pl = new PointLight(Color.RED);
              pl.setTranslateZ(-1000);
              
              Group root = new Group(sphere, pl);
              root.setTranslateX(250);
              root.setTranslateY(250);
              Scene scene = new Scene(root, 500, 500, true);
              scene.setCamera(new PerspectiveCamera());
              scene.setOnKeyPressed(new EventHandler<KeyEvent>() {

                  @Override
                  public void handle(KeyEvent t) {
                      System.out.println(pm.toString());
                  }
              });
              stage.setScene(scene);
              stage.show();
          }

          public static void main(String[] args) {
              launch(args);
          }
      }

            kcr Kevin Rushforth
            aglushch Andrew Glushchenko (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: