On Wed, 27 Oct 2021 10:28:32 GMT, Alexander Zuev <[email protected]> wrote:

>> Unfortunately the creation should be dine on EDT as well
>
>> Unfortunately the creation should be dine on EDT as well
> 
> Why? Neither component or frame has peers assigned, not like their status is 
> being changed by another thread and they do not receive any events from EDT 
> yet. Then what is the reason for moving component creation to EDT?

It does not relate to the peers(actually peers and awt components can be used 
on different threads), it is just a requirement for the Swing library all its 
api should be used only on the EDT, otherwise too many things can go wrong, 
which includes the simple visibility across the threads, and more complex out 
of order events execution - when you created a component on main thread it can 
post an event to EDT, and that event will be executed in parallel with your 
code on main.

-------------

PR: https://git.openjdk.java.net/jdk/pull/6104

Reply via email to