Hi all friends, Iam facing problem with updation of progressBar of my swing Interface.I want to update my progressBar by the bytes which is already written by server on destination.It is basically a uploading software.For that iam using a thread and i have written a method of taking the bytes from servlet.And in servlet iam writting bytes by 'PrintWriter' in loop.But I couldn't update progressBar.Can any one plz guide me where i am wrong in my code.If possible plz give me some code for that.Iam pasting those portion of codes only.Eagerly waiting for someone reply.
posted 12 years ago
The problem is that swing components are not thread safe. You should never change the state of a swing component except in the swing dispatcher thread. You can use a javax.swing.Timer to do it like this:
Moving this to the Swing forum.
Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher