vendredi 24 juin 2016

How to insert an event to the beginning of Event Dispatch Thread queue in java?

I already know how Event Dispatch thread works. If there be short and long events in Event Dispatch thread like below, the application can't be responsive.

enter image description here

For the Sake of responsiveness in Swing, Event Dispatch thread should only be used for short events. while long events should be executed on SwingWorkers.

enter image description here

Imagine that there is a lot of short events.

enter image description here The events should be executed in Event Dispatch thread and you have a special event which you want to be executed before other events existing in Event Dispatch Thread queue. But, events will be enqueued to the end of the queue by default and even InvokeLater do the same.

So, is there any solution to enqueue an event to the beginning of the Event Dispatch Thread?

Aucun commentaire:

Enregistrer un commentaire