Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Delay problem on a chat program  RSS feed

 
Shay Gaghe
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Coders!
I�m developing a chat program based on Swing. The client has lots of features and plenty of internal work to do. I sense delay when I�m pressing on a button and it takes extra time until the button return to its undressed state.
My questions are :
1.Do I need to keep all the hard work to the server?
2.Do I need to worry about the delay symptoms ?
3.Whenever I divide an operation to a several
method,does it increase the processing time?
4.does objects effects in some way on the processing
time (I mean importing and using them)
Thanks in advance
Shay

 
parul patidar
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
when I�m pressing on a button and it takes extra time until the button return to its undressed state.
what r u doing in actionPerformed for this button
r u using servlet as server??
r u making connection to server on button press??
Originally posted by Shay Gaghe:
Hello Coders!
I�m developing a chat program based on Swing. The client has lots of features and plenty of internal work to do. I sense delay when I�m pressing on a button and it takes extra time until the button return to its undressed state.
My questions are :
1.Do I need to keep all the hard work to the server?
2.Do I need to worry about the delay symptoms ?
3.Whenever I divide an operation to a several
method,does it increase the processing time?
4.does objects effects in some way on the processing
time (I mean importing and using them)
Thanks in advance
Shay

 
Shay Gaghe
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
>r u using servlet as server??
>r u making connection to server on button press??
In my program I use an application that based on ServerSocket as the server. My client has to deal with plenty of internal operation like changing graphical states, drawing images and sending streams.
My start button make the first connection to server and in the other hand sends a login request to the server , the time that takes to concocted the necessary information ,send and receive the server�s response makes the button to wait until all of those task will be completed to change its state back to unpressed state.
If that not clear I�ll post the actionPerformed() here.
thanks
 
parul patidar
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

ok
i too faced similar problem the reason is
once control gets inside actionPerformed
paint is not called in a frame or applet until
it gets out of actionPerformed
try putting an infionite loop in actionPerformed and press the button u will find that button remains pressed forever
the solution i think is
whatever you are doing on that button click do it in a seperate thread

or
try following
call
validate ()
doLayout()
show()
repaint()
or these type of component class method
not sure but this can also solve ur prob
but prefer first method if it is possible for u to create a new thread i think it will definitely solve ur problem
parul patidar

Originally posted by Shay Gaghe:
Hi
>r u using servlet as server??
>r u making connection to server on button press??
In my program I use an application that based on ServerSocket as the server. My client has to deal with plenty of internal operation like changing graphical states, drawing images and sending streams.
My start button make the first connection to server and in the other hand sends a login request to the server , the time that takes to concocted the necessary information ,send and receive the server�s response makes the button to wait until all of those task will be completed to change its state back to unpressed state.
If that not clear I�ll post the actionPerformed() here.
thanks

 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!