title: Detect URL change in JavaFX WebView
body: <p>In JavaFX's <code>WebView</code> I am struggling to detect change in URL. </p>
  
  <p>I have this method in a class:</p>
  
  <pre><code>public Object urlchange() {
      engine.getLoadWorker().stateProperty().addListener(new ChangeListener&lt;State&gt;() {
          @Override
          public void changed(ObservableValue ov, State oldState, State newState) {
              if (newState == Worker.State.SUCCEEDED) {
                  return engine.getLocation()); 
              }
          }
      });         
  }
  </code></pre>
  
  <p>and I am trying to use it for an object called loginbrowser like:</p>
  
  <pre><code>System.out.print(loginbrowser.urlchange());
  </code></pre>
  
  <p>Can you see what I've done wrong?</p>