Hi,
I would like to have two CodeArea's next to each other with the same content height to be always scrolled to the same position. Scrolling on the left makes the right follow as assumed. Scrolling on the right produces several unexpected results:
- left does not always scroll to the endposition (top/bottom most)
- after a short downmovement an up movement on the scrollwheel results in more down movement of the content
My code
public class Test2 extends Application{
String ts = "42\n\n54\n5435\n4325\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n5435\n\n423\n53\n2\n5423\n5342\n54\n5435\n4325\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n5435\n\n423\n53\n2\n5423\n53";
@Override
public void start(Stage primaryStage) throws Exception {
HBox sp = new HBox();
CodeArea lca = new CodeArea();
VirtualizedScrollPane<CodeArea> lsp = new VirtualizedScrollPane<>(lca);
CodeArea rca = new CodeArea();
VirtualizedScrollPane<CodeArea> rsp = new VirtualizedScrollPane<>(rca);
sp.getChildren().addAll(lsp, rsp);
lca.estimatedScrollYProperty().bindBidirectional(rca.estimatedScrollYProperty());
lca.replaceText(ts);
rca.replaceText(ts);
Scene sc = new Scene(sp);
primaryStage.setScene(sc);
primaryStage.show();
}
public static void main(String[] args){
launch(args);
}
}
This standard JavaFX Code illustrates the intended behaviour:
public class Test3 extends Application{
String ts = "42\n\n54\n5435\n4325\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n5435\n\n423\n53\n2\n5423\n5342\n54\n5435\n4325\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n5435\n\n423\n53\n2\n5423\n53";
@Override
public void start(Stage primaryStage) throws Exception {
HBox sp = new HBox();
TextArea lca = new TextArea();
TextArea rca = new TextArea();
sp.getChildren().addAll(lca, rca);
rca.scrollTopProperty().bindBidirectional(lca.scrollTopProperty());
lca.setText(ts);
rca.setText(ts);
Scene sc = new Scene(sp);
primaryStage.setScene(sc);
primaryStage.show();
}
public static void main(String[] args){
launch(args);
}
}
Hi,
I would like to have two CodeArea's next to each other with the same content height to be always scrolled to the same position. Scrolling on the left makes the right follow as assumed. Scrolling on the right produces several unexpected results:
My code
This standard JavaFX Code illustrates the intended behaviour: