Total members 11890 |It is currently Thu Apr 18, 2024 12:30 pm Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





get time difference between to mouse-clicks
java code
import java.awt.Graphics;

public class HandleTimeApplet extends java.applet.Applet {

public long firstClickTime = 0;
public String msgToDisplay;

public void init() {
msgToDisplay = "Double Click";
}
public void paint(Graphics g) {
g.drawRect(0, 0, size().width-1, size().height-1);
g.drawString(msgToDisplay, 40, 30);
}
public boolean mouseDown(java.awt.Event evt, int x, int y) {
long clickTime = System.currentTimeMillis();
long clickInterval = clickTime - firstClickTime;
if (clickInterval < 200) {
msgToDisplay = "Double Click!! (Interval = " + clickInterval + ")";
firstClickTime = 0;
} else {
msgToDisplay = "Single Click!!";
firstClickTime = clickTime;
}
repaint();
return true;
}
}




_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time
Post new topic Reply to topic  [ 1 post ] 

  Related Posts  to : get time difference between to mouse-clicks-double clicks
 Applet get mouse clicks and draw circle     -  
 draw any number of lines on mouse clicks     -  
 draw any number of circles using mouse clicks     -  
 Draw Cardinal Spline With Mouse Clicks Points     -  
 Draw curves using Hermite Curve equations with mouse clicks     -  
 show the locations of clicks on the image     -  
 avoid multiple submit clicks using javascript     -  
 How to track clicks on hash links from Google analytic     -  
 difference between preemptive scheduling and time slicing     -  
 double value be cast to a byte     -  



cron





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com