java - Adding items to ListView in JavaFx... threading? -


i'm trying add string listview in javafx whilst processing, keeps freezing gui.

i've tried following threading - can't seem work listview.
know how/have example of how can update listview in javafx whilst processing data?

new thread(new runnable() {     @override public void run() {         (int i=1; i<=1000000; i++) {             final int counter = i;             platform.runlater(new runnable() {                 @override public void run() {                     recentlist.getitems().add(integer.tostring(counter));                 }             });         }     }}).start(); 

using platform.runlater() correct way go. could, also, store string result integer.tostring(counter) in background thread (not ui one). way, should use string.valueof (there thread on stackoverflow talks it).

i assume ui freezing because of execution speed of (very simple) loop.

you should have @ concurrency in javafx


Comments

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -