~/ learn/ comp-308/ cards/ Swing + threading: the Event Dispatch Thread
1 of 7

Type an EDT-safe UI update from a background thread

Type an EDT-safe UI update from a background thread

Answer

SwingUtilities.invokeLater(() -> log.append("Event fired: LightOn\n"));

invokeLater queues the Runnable onto the EDT’s event queue — the only safe way for a worker thread to touch a Swing component.

space flip · ← → navigate · esc to exit
NORMAL ~/memra/library/4921f4ce-0cf6-45be-82ed-9433d4ccdf22/flashcard utf-8 LF