title: Bug in JavaFX by binding with middle man onto slider value property?
body: <p>I stumbled upon a problem using a slider in JavaFX.<br>
  I create a fxml-file with a <em>Slider</em> and add a controller to it.<br>
  Inside the controller I have a <em>DoubleProperty</em>, which binds to the <em>Slider</em>'s <em>valueProperty</em>. Then, when I want to bind to this property from somewhere else, I bind to the property, which is inside the controller (some kind of a middle-man approach see Figure).<br>
  <a href="https://i.stack.imgur.com/cQ7Dq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cQ7Dq.png" alt="enter image description here"></a><br>
  But when I do so, it does not work properly.  </p>
  
  <p>When I use the slider, the values get updated accordingly for a while, but when I wiggle it around, at some point it seems to stop updating the binding and refuses to do so again even after releasing and pressing it again.<br>
  When I delete the middle-man property in the controller and just pipe through the <em>valueProperty</em> from the slider directly, it is working.  </p>
  
  <p><strong>Program:</strong><br>
  Main.java  </p>
  
  <pre><code>public class Main extends Application{
      private MainController controller;
  
      @Override
      public void start(Stage primaryStage) throws Exception {
          FXMLLoader loader = new FXMLLoader();
          loader.setLocation(getClass().getResource("main.fxml"));
          Parent root = loader.load();
          controller = loader.getController();
  
          Scene scene = new Scene(root);
          primaryStage.setScene(scene);
  
          primaryStage.show();
  
          showSlider();
      }
  
      private void showSlider() {
          SliderShower sliderShower = new SliderShower();
          sliderShower.show();
          sliderShower.getSliderValueProp().addListener(((observable, oldValue, newValue) -&gt; {
              controller.setText(Double.toString((double)newValue));
          }));
      }
  
      public static void main(String[] args) {
          launch(args);
      }
  }
  </code></pre>
  
  <p>main.fxml
      </p>
  
  <pre><code>&lt;?import javafx.scene.control.Label?&gt;
   &lt;?import javafx.scene.layout.ColumnConstraints?&gt;
   &lt;?import javafx.scene.layout.GridPane?&gt;
   &lt;?import javafx.scene.layout.RowConstraints?&gt;
  
   &lt;GridPane prefHeight="100.0" prefWidth="100.0" xmlns="http://javafx.com/javafx/8.0.112" xmlns:fx="http://javafx.com/fxml/1" fx:controller="sliderBug.main.MainController"&gt;
     &lt;columnConstraints&gt;
       &lt;ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" /&gt;
     &lt;/columnConstraints&gt;
     &lt;rowConstraints&gt;
       &lt;RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /&gt;
     &lt;/rowConstraints&gt;
      &lt;children&gt;
         &lt;Label fx:id="label" text="Label" /&gt;
      &lt;/children&gt;
   &lt;/GridPane&gt;
  </code></pre>
  
  <p>MainController.java  </p>
  
  <pre><code>public class MainController {
      @FXML
      private Label label;
  
      public void setText(String text) {
          label.setText(text);
      }
  }
  </code></pre>
  
  <p>SliderShower.java  </p>
  
  <pre><code>public class SliderShower {
      private Parent root;
      private SliderShowerController controller;
      private Stage stage;
      private DoubleProperty sliderValueProp;
  
      public SliderShower() {
          sliderValueProp = new SimpleDoubleProperty(0);
          FXMLLoader loader = new FXMLLoader();
          loader.setLocation(getClass().getResource("sliderShower.fxml"));
          try {
              root = loader.load();
              controller = loader.getController();
              stage = new Stage();
              stage.initModality(Modality.APPLICATION_MODAL);
              stage.setScene(new Scene(root));
  
              sliderValueProp.bind(controller.getSliderValueProp());
          } catch (IOException e) {
              e.printStackTrace();
          }
      }
  
      public DoubleProperty getSliderValueProp() {
          return sliderValueProp; // This does not work
  //        return controller.getSliderValueProp(); // This would work
      }
  
      public void show() {
          stage.show();
      }
  }
  </code></pre>
  
  <p>sliderShowerController.java</p>
  
  <pre><code>public class SliderShowerController {
      @FXML
      private Slider sliderUI;
  
      DoubleProperty getSliderValueProp() {
          return sliderUI.valueProperty();
      }
  }
  </code></pre>
  
  <p>sliderShower.fxml  </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
  &lt;?import javafx.scene.control.Slider?&gt;
  &lt;?import javafx.scene.layout.ColumnConstraints?&gt;
  &lt;?import javafx.scene.layout.GridPane?&gt;
  &lt;?import javafx.scene.layout.RowConstraints?&gt;
  
  &lt;GridPane prefHeight="100.0" prefWidth="300.0" xmlns="http://javafx.com/javafx/8.0.112" xmlns:fx="http://javafx.com/fxml/1" fx:controller="sliderBug.sliderShower.SliderShowerController"&gt;
    &lt;columnConstraints&gt;
      &lt;ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" /&gt;
    &lt;/columnConstraints&gt;
    &lt;rowConstraints&gt;
      &lt;RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /&gt;
    &lt;/rowConstraints&gt;
     &lt;children&gt;
        &lt;Slider fx:id="sliderUI" max="200.0" min="1.0" /&gt;
     &lt;/children&gt;
  &lt;/GridPane&gt;
  </code></pre>
  
  <p>Here is a link to a repository depicting the problem:<br>
  <a href="https://github.com/Chrisss50/sliderBug" rel="nofollow noreferrer">https://github.com/Chrisss50/sliderBug</a>  </p>
  
  <p>Am I doing something wrong or is this just a bug?  </p>
  
  <p>Greetings</p>