Java Timer suggestions needed

K

Kaish

Hello all,

I'm coding an application that tracks mouse movements (using
mouseListener and mouseMotionListener). I want to be able to time how
long a cursor remains on a certain component - for example, how long a
user keeps his cursor over a button.

Any suggestions on how to go about this?

Thanks.
 
K

Knute Johnson

Kaish said:
Hello all,

I'm coding an application that tracks mouse movements (using
mouseListener and mouseMotionListener). I want to be able to time how
long a cursor remains on a certain component - for example, how long a
user keeps his cursor over a button.

Any suggestions on how to go about this?

Thanks.

Sure. There is a MouseEvent generated every time you enter and exit a
component with the mouse. Write a MouseListener that records the time
on enter and subtract that from the time on exit.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top