I have read JAVA SWING UI become more efficient with the help of threads.But i dont know how the java threads makes the UI more perfect in Swing.

Please Enlighten me on this...

有帮助吗?

解决方案

Using threads you can do work asynchronously without blocking the UI. Lets say you have two buttons Search google and Search bing ( yes on your swing UI can not think of better analagy right now :) )

If you were not using threads your application window will block i.e. you will not be able to click other button or do any thing else until first function has completed but with thread nothing is blocking and you can continue on working and using you UI even click both at the same time .

其他提示

Please read the following APIs:
SwingWorker
Timer

And also you need to know about how AWT Event queue interacts with your program. You can find that information here.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top