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

Shape3D.setMaterial(material) seems to be required to get the color to update

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P3 P3
    • 8
    • 8
    • javafx

      Shape3D.setMaterial(material) seems to be required to get the color to update

      If this line isn't called inside the handle method:
          pointLight2Geo.setMaterial(pointLight2Material); // <-- this is required for color to update
      then the color doesn't update.

              final private Sphere pointLight2Geo = new Sphere(0.1);
      ...
              final PhongMaterial pointLight2Material = new PhongMaterial();
              pointLight2Material.setDiffuseColor(Color.LIGHTGREY);
              pointLight2Geo.setMaterial(pointLight2Material);
      ...
              final ColorPicker light2ColorPicker = new ColorPicker(pointLight2.getColor());
              light2ColorPicker.setOnAction(new EventHandler<ActionEvent>() {
                  @Override
                  public void handle(ActionEvent t) {
                      Color c = light2ColorPicker.getValue();
                      pointLight2.setColor(c);
                      pointLight2Material.setDiffuseColor(c);
                      pointLight2Geo.setMaterial(pointLight2Material); // <-- this is required for color to update
                  }
              });

            yaow Yao Wang (Inactive)
            jyoon John Yoon (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: