w********r 发帖数: 5 | 1 When a function is running, the frame seems dead. It won't be repainted even
if it is only moved. If modify some text in the component, it won't update it.
How to make it work? I want to show something when the algorithm is running. I
tried "validate", "update", "repaint". None of them works. Maybe I didn't call
them in the correct way. Nothing need to do when using awt components. The
component will be updated whenever it is modified. Anything special with
swing?
Thank you very much | f********h 发帖数: 149 | 2 remeber java vm does the swing related sutff in a separate thread, so if you
invoke method like update,repaint in your computational-expensive thread, you
will never see any update immediately.
Look at Timer class. It will help you.
【在 w********r 的大作中提到】 : When a function is running, the frame seems dead. It won't be repainted even : if it is only moved. If modify some text in the component, it won't update it. : How to make it work? I want to show something when the algorithm is running. I : tried "validate", "update", "repaint". None of them works. Maybe I didn't call : them in the correct way. Nothing need to do when using awt components. The : component will be updated whenever it is modified. Anything special with : swing? : Thank you very much
|
|