This is a fairly common GUI programming element. You have one thread that processes the graphical user interface, receives input, and makes callbacks. If another thread tries to modify GUI-related objects, it will conflict with the GUI thread. Say, for example, it was half by drawing something, and you change the color from another thread.
Everything invokeLater makes a queue for something for the GUI thread to run. Later, it works almost instantly, but the current thread does not need to wait for it. The GUI thread may draw or wait for the callback to return, which delays the execution of the code you gave it.
source share