Java GUI Framework Question:

What is difference between invokeAndWait and invokeLater?

Tweet Share WhatsApp

Answer:

This swing interview question is asked differently at different point. some time interviewer ask how do you update swing component from a thread other than EDT, for such kind of scenario we use SwingUtilities.invokeAndWait(Runnable r) and SwingUtilities.invokeLetter(Runnable r) though there are quite a few differences between these two, major one is invokeAndWait is a blocking call and wait until GUI updates while invokeLater is a non blocking asynchronous call. In my opinion these question has its own value and every swing developer should be familiar with these questions or concept not just for interview point of view but on application perspective. you can read more on my post How InvokeAndWait and InvokeLater works in Swing

Download Java GUI Framework PDF Read All 28 Java GUI Framework Questions
Previous QuestionNext Question
Why Swing components are called lightweight component?Write code for JTable with custom cell editor and custom cell renderer?