• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

facing isue with wait method in java

 
Ramesh Sengani
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi,

I am working in site where i have search options.

I want that when user will click on search button, search should take minimum 5 seconds or more then that. In that period i want to show progressbar with advertisement.
 
Alexander Kober
Ranch Hand
Posts: 32
IntelliJ IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're looking in the wrong place.

The wait method is used to synchronize threads, not to delay a user interface update. What you want to do would look more like this:



This example does not consider threading. If this were done in swing, for instance, you'd want to run the entire method on a worker and dispatch showAdvertisement() and hideAdvertisement() on the EDT, but i guess this is going too much into detail.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic