I know what “stream” means, and if I understand the event dispatch (EDT) stream as “just a stream,” it explains a lot, but it doesn't seem to explain everything.
I do not understand what is special about this topic. For example, I don’t understand why do we need to start a graphical interface in EDT? Why is the "main" thread a bed for a GUI? Well, if we just don’t want to occupy the main thread, why can't we only run the GUI in a “different thread”, why should it be some kind of “special” thread called EDT?
Then I do not understand why we can not start EDT, like any other thread? Why should we use some special tool (called invokeLater ). And why the GUI, unlike any other thread, does not start immediately. We must wait until he is ready to accept our work. Is it because the EDT can possibly perform several tasks at once?
If you decide to answer this question, could you use really simple terminology, because otherwise, I am afraid, I will not be able to understand the answer.
ADDED:
I always thought that we have one “task” for each thread. Thus, in each thread, we execute a predefined sequence of commands. But it seems to me that in the case of sending a stream, we may have a problem. Well, they are not executed at the same time (threads switch between different tasks, but in one thread there is another task). It is right? For example, in EDT there is one thread that displays the main window, and then in addition to this, we sent another task to EDT, which should update one of the components of the window, and EDT will execute this new task whenever it is ready. So is EDT different from other threads?
java multithreading user-interface
Roman
source share