2018년 3월 12일 월요일

[JavaFX] How to update GUI controls in Threads


Use Platform.runLater() function to update GUI controls from Threads. The Runnable() function will be called later in the main thread.
1
2
3
4
5
6
    Platform.runLater(new Runnable() {
        @Override
        public void run() {
            //update GUI here
        }
    });

Java 8 lambda expression example:
1
Platform.runLater(() -> buttonExit.setText(""));


댓글 없음:

댓글 쓰기