Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Swing / AWT / SWT and the fly likes Timer & mouseListener Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Timer & mouseListener" Watch "Timer & mouseListener" New topic

Timer & mouseListener

Sonara Rahul
Ranch Hand

Joined: Jul 07, 2001
Posts: 60
Hello Friends,
I have a problem with mouselisteners.
Here its.
I have 5 panels whose label content is a country names. 5 more panels on left side,with the labelcontent capitals).So i have to drag a panel from right side & place in it on the left side if the capital matches the country label placed on the leftside panel then rightside panel should be placed near the left side panel.
If the answer is wrong then it should bounce back to its original position.
This works fine.
But when the answer is wrong it should wait for few secs inidicating by setting a icon to that label(label on the left side) & then bounce back to its orignal position.
This is also done with timer so that it waits for few sec to indicate its wrong.
The problem is when the answer is wrong timer action starts & the action taking place are changing label icon & then bonuce back to the original position.
If i drag the panels on the right side fastly, & if all panels answer is wrong then it get struck in the middle what should i do.
If i give less milliseconds the wrong answer indication doesn't take place.But its get struk while dragging fastly.
If i give more milliseconds,wrong answer indication takes place but it gets struk while draggin the panels fastly.
So tell me a suggestion to get both not to struck while dragging fastly & the same it should be visible if its wrong.
Excepting u'r suggestion & solutions,
With regards,
[ February 11, 2002: Message edited by: Sonara Rahul ]
Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
Hi Sonara,
Would it be possible to remove the drag-drop listener during the waiting period? This would remove the possibility that anything has changed in the waiting time.
Sonara Rahul
Ranch Hand

Joined: Jul 07, 2001
Posts: 60
Hello manfred,
Could u pl.. explain me in detail.I can't get u.
with regards
I agree. Here's the link:
subject: Timer & mouseListener
jQuery in Action, 3rd edition