In my JavaFX
project I was using 2 TextFlows
to display some text. I used vvalueProperty
of ScrollPanes
which are holding the TextFlows
to scroll both TextFlow
at same time
scrolPane1.vvalueProperty().bindBidirectional(scrolPane2.vvalueProperty());
But since TextFlow
is only support in Java 8
, Im trying to replace them with ListView
. How can I scroll 2 ListViews
at same time? Since ListView
contains a inner ScrollPane
my approach that worked with TextFlow doesn't work here.
Simply I want to scroll 2 ListViews
at same time.
Try something like
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
}
}
}
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.