• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Delay problem on a chat program

 
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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


 
Yes, of course, and I accept that blame. In fact, i covet that blame. As does this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic