2014-09-17 8 views
1

Dans mon projet JavaFX, j'utilisais 2 TextFlows pour afficher du texte. Je vvalueProperty de ScrollPanes qui tient la TextFlows pour faire défiler les deux TextFlow en même tempsScroll 2 listview en même temps

scrolPane1.vvalueProperty().bindBidirectional(scrolPane2.vvalueProperty()); 

Mais depuis TextFlow est le soutien que dans Java 8, Im essayant de les remplacer par ListView. Comment faire défiler 2 ListViews en même temps? Depuis ListView contient une ScrollPane interne mon approche qui a travaillé avec TextFlow ne fonctionne pas ici. Je veux simplement faire défiler 2 ListViews en même temps.

Répondre

3

Essayez quelque chose comme

Platform.runLater(new Runnable() { 
    @Override 
    public void run() { 
     Node n = listView1.lookup(".scroll-bar"); 
     if (n instanceof ScrollBar) { 
      final ScrollBar bar = (ScrollBar) n; 
      if (bar.getOrientation().equals(Orientation.VERTICAL)) { 
       // get the second scrollbar of another listview and bind values of them 
      } 
     } 
    } 
}); 
+0

Merci :) Il a travaillé –