I have a window with a text entry field for the search and a VBox where the search results are displayed.
I made it so that with every change in the text box from the VBox everything is deleted and refilled, but you can see the moment of deletion and filling.

 private void showSearchusers(Object[][] objects) { Platform.runLater(()->model.getUsers().clear()); for (Object[] object : objects) { Contact contact = new Contact(object,true,this); model.addUsers(contact); } } 

Actually, I would like to know if there is any way to get rid of flickering when redrawing, mb freeze the animation for a few ms?

    1 answer 1

    Found a solution to your problem with AnimationTimer .

     private void showSearchusers(Object[][] objects) { AnimationTimer at = new AnimationTimer() { // Π—Π΄Π΅ΡΡŒ ΠΊΠΎΠ»-Π²ΠΎ Ρ‚ΠΈΠΊΠΎΠ² прорисовки int fps = 0; // Π­Ρ‚ΠΎΡ‚ ΠΌΠ΅Ρ‚ΠΎΠ΄ вызываСтся ΠΊΠ°ΠΆΠ΄Ρ‹ΠΉ Ρ€Π°Π· ΠΊΠΎΠ³Π΄Π° JavaFX обновляСт ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅, ΠΎΠ±Ρ‹Ρ‡Π½ΠΎ это 60 Ρ€Π°Π· Π² сСк. @Override public void handle(long now) { fps++; if (fps>1){ Platform.runLater(()->model.getUsers().clear()); for (Object[] object : objects) { Contact contact = new Contact(object,true,getThis()); Platform.runLater(()->model.getUsers().add(contact)); } // БбрасываСм счСтчик ΠΈ останавливаСм Π°Π½ΠΈΠΌΠ°Ρ†ΠΈΡŽ fps=0; this.stop(); } } }; // ЗапускаСм Π°Π½ΠΈΠΌΠ°Ρ†ΠΈΡŽ at.start(); } 

    Although in the example I set the update in 1 fps, personally my blinks stopped.