Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trapping successive mouse clicks in a swing app

Status
Not open for further replies.

MGoel

Programmer
Jan 26, 2002
17
US
Hi Folks,

We have a swing based applet application. In this applet we have several forms with buttons to move to next screen.

Now when we are on the beginning form and click on Next button using mouse quickly several times it moves to that many screens ahead even though there are checks that certain inputs are required.

How can we stop this to happen and do not let the mouse clicks to move to next set of screens without being validated first.

Thanks in advance,

Manoj
 
You could force a delay on the buttons. When you click on a button, create a short timed thread (ie one that dies after 2 seconds). When the button is clicked again, ensure that the timed thread is not alive before advancing to the next page (or creating a new thread). There is probably a more elegant way to do this, but this is the first thing that popped into my head.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top