Cross-posting to swing-dev and awt-dev.

On 7/2/2013 6:10 AM, Leonid Romanov wrote:

On Jun 28, 2013, at 9:32 PM, Artem Ananiev <[email protected]> wrote:

This is a bug in eAWT, which uses SwingUtilities.invokeLater(), but should use 
SunToolkit.postEvent(AppContext, AWTEvent) or similar.

What do you think about introducing a new API, like 
SwingUtilities.invokeLater(Runnable runnable, Component target) which would 
invoke the runnable using the target's AppContext? It might be useful both for 
AWT/Swing engineers and apps writers.

I don't think SwingUtilities/EventQueue is the right place for such API. It's useless for app developers, as application code should always be in the right AppContext, i.e. invokeLater(Runnable) should always post the runnable to the right place.

Such API is useful, when your code is on a thread like the toolkit thread (AppKit thread on OS X). So a better place would be SunToolkit or SwingUtilities2, but SunToolkit already has a method named executeOnEventHandlerThread().

Thanks,

Artem

Leonid.

Reply via email to