title: How to auto-scroll to the end in WebView?
body: <p>I've problem with Scrollbar in WebView. I want to when the web view loaded, the srollbar auto scroll to the end of web view.
  How can I do it?</p>
  
  <p>This is my sample</p>
  
  <pre><code>package sample;  
  import javafx.fxml.FXML;  
  import javafx.fxml.Initializable;  
  import javafx.scene.Node;  
  import javafx.scene.control.ScrollBar;  
  import javafx.scene.web.WebEngine;  
  import javafx.scene.web.WebView;  
  import java.net.URL;  
  import java.util.ResourceBundle;  
  import java.util.Set;  
  public class Controller implements Initializable {  
      @FXML  
      WebView webView;  
      @Override  
      public void initialize(URL url, ResourceBundle resourceBundle) {  
          loadWebView();  
      }  
      private void loadWebView() {  
          webView.setStyle("-fx-background-color: #cccccc; -fx-border-color: #00a7c8");  
          StringBuilder html= new StringBuilder().append("&lt;html&gt;&lt;body&gt;");  
          for (int i=0; i&lt;100; i++) {  
              html.append("&lt;h1&gt;" + i + ". AAAAAAAAAAAA&lt;/h1&gt;&lt;/br&gt;");  
          }  
          html.append("&lt;/body&gt;&lt;/html&gt;");  
          Set&lt;Node&gt; nodes = webView.lookupAll(".scroll-bar");  
          for (Node node : nodes) {  
              if (ScrollBar.class.isInstance(node)) {  
                  System.out.println("Scrollbar here!!!");  
                  ScrollBar scroll = (ScrollBar) node;  
                  scroll.setValue(scroll.getMax());  
              }  
          }  
          WebEngine webEngine = webView.getEngine();  
          webEngine.loadContent(html.toString());  
      }  
  }  
  </code></pre>
  
  <p>Thanks 4 your reading</p>