0 votes
in JAVA by
is Swing thread-safe?

1 Answer

0 votes
by

No, Swing is not thread-safe. You cannot update Swing components e.g. JTable, JList or JPanel from any thread, in fact, they must be updated from GUI or AWT thread. That's why swings provide invokeAndWait() and invokeLater() method to request GUI update from any other threads. This methods put update request in AWT threads queue and can wait till update or return immediately for an asynchronous update. You can also check the detailed answer to learn more.

Related questions

0 votes
asked Dec 4, 2019 in JAVA by rajeshsharma
0 votes
asked Apr 14, 2023 in JAVA by SakshiSharma
...