I created one JavaFX application where I update the log with one background process. So I set the log text to TextArea and set the scroll down using logs.setScrollTop(Double.MAX_VALUE) . but the scroll bar is set a little bit from bottom to top. I also tried TextFlow inside ScrollPan and set the scroll down using logDisplay.setVvalue(1.0) . It also gives the same result.
Platform.runLater(() -> { logs.setText([setting log text]);//TextArea logs logs.setScrollTop(Double.MAX_VALUE)); }); //For TextFlow inside ScrollPane Platform.runLater(() -> { logs.setText([setting log text]);//Text logs logDisplay.setVvalue(1.0); });
I also tried to run the code in a separate thread, for example
new Thread() { public void run(){ System.out.println("called set test"); logs.setText([setting log text]);
But nothing works :(
Can you help me with this wrong?
Thanks
- Edit--
The problem seems to be related to the problem of streaming. The scrollbar value is updated to the previous text value. In fact, when retrieving the scroll value, it does not get the last value, but gets the old value, so the scroll bar is set to the end of the previous message, and not the last last line.
source share