title: JavaFX binding a BooleanProperty to Paint
body: <p>I am writing a code that can take some boolean values from a part of some other code and change colours of certain circles on the screen accordingly. However I ran into problems trying to bind the boolean values to colours. I ended up with this:</p>
  
  <pre><code>unit1.getNeuron().getWorkingProperty().addListener(new ChangeListener&lt;Boolean&gt;() {
  
          @Override
          public void changed(ObservableValue&lt;? extends Boolean&gt; observable, Boolean oldValue, Boolean newValue) {
              if (newValue == Boolean.FALSE) {
                  controller.paint1 = new ObservableValueBase&lt;Paint&gt;() {
  
                      @Override
                      public Paint getValue() {
                          return Color.RED;
                      }
                  };
              } else {
                  controller.paint1 = new ObservableValueBase&lt;Paint&gt;() {
  
                      @Override
                      public Paint getValue() {
                          return Color.DODGERBLUE;
                      }
                  };
  
              }
          }
      });
  </code></pre>
  
  <ul>
  <li>but I'll have to repeat it for n times for n variables I use. Is there a different way to implement this?</li>
  </ul>