title: synchronized Listview Scrolling
body: <p>I have two adjacent scrollbars. I need to synchronize their scrolling so they move vertically together. The ListView on the left will most likely have more items than the ListView on the right. I need the left-hand ListView to scroll all the way down. I attempted to use the code:</p>
  
  <pre><code>    Node n1 = listView1.lookup(".scroll-bar");
      if (n1 instanceof ScrollBar) {
          final ScrollBar bar1 = (ScrollBar) n1;
          Node n2 = listView2.lookup(".scroll-bar");
          if (n2 instanceof ScrollBar) {
              final ScrollBar bar2 = (ScrollBar) n2;
              bar1.valueProperty().bindBidirectional(bar2.valueProperty());
          }
      }
  </code></pre>
  
  <p>but it doesn't seem to work, mainly because it does not pick up that n1 is an instance of ScrollBar and n1 is set to NULL. I'm not sure why the lookup function is not setting a node value.</p>
  
  <p>Here are a list of the imports I am using:</p>
  
  <pre><code>import java.io.IOException;
  import java.net.URL;
  import java.time.LocalDate;
  import java.util.ArrayList;
  import java.util.List;
  import java.util.ResourceBundle;
  import javafx.event.ActionEvent;
  import javafx.fxml.FXML;    
  import javafx.fxml.FXMLLoader;
  import javafx.fxml.Initializable;
  import javafx.scene.Node;
  import javafx.scene.Parent;
  import javafx.scene.Scene;
  import javafx.scene.control.Button;
  import javafx.scene.control.DatePicker;
  import javafx.scene.control.ListView;
  import javafx.scene.control.ScrollBar;
  import javafx.stage.Stage;
  </code></pre>
  
  <p>Any help would be appreciated.</p>