java – EventQueue. invokeLater vrs SwingUtilities. invokeLater

Can anyone highlight the difference between the two? Both are required?!

I have an application that uses both, but wonder if one is better than the other Obviously they all accept runnable objects, so for me - I think I can use the one I like

Why are these two similar functions in different classes? I know there is one in AWT and another in swing, but aren't they doing the same thing?

Solution

SwingUtilities. Invoker exists only because of the introduction of eventqueue in 1.2 Invoker, but swing can be used for 1.1 Swing in JRE always calls only the eventqueue version swingall. Jar has hacks that create a component and perform pending operations when redrawing

Invoker is about eventqueue I suggest using this method directly Swing utilities is just a dumping ground I've seen a lot of using swing utilities Invoker may believe that swing does not depend on AWT to some extent

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>