In doClick()
when it calls doClick(pressTime)
does it send 68 milliseconds? Why did they decide on 68 instead of a more round number? Is it a completely arbitrary number?
From Java AbstractButton:
public void doClick() {
doClick(68);
}
In doClick()
when it calls doClick(pressTime)
does it send 68 milliseconds? Why did they decide on 68 instead of a more round number? Is it a completely arbitrary number?
From Java AbstractButton:
public void doClick() {
doClick(68);
}
It might have to do with how fast a human can click on average.
If you look at this timer, with a bit of excersise it's possible to reach the 68ms on average.
They might have simply made a setup like below, had a go at it to get on a nice average click duration and then used that for the default value.
var timer = 0;
var results = [];
$('#clicktest').on('mousedown',function() {
timer = window.performance.now();
});
$('#clicktest').on('mouseup',function() {
results.push(window.performance.now()-timer);
var total = 0;
for(c=0;c<results.length;c++) {
total+= results[c];
}
$('#output').text('Average click duration '+ Math.round(total/results.length)+'ms');
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<button id="clicktest">Click me</button>
<div id="output">Average click duration N/A</div>
Metal L&F
just and only as a defaults, f.e. Windows L&F
totally ignores that, it hasn't this method as peer or returns for programing languages thats runs from Win session,doClick is programatically to simulating the JButton
press e.g. from mouse or key event (TAB
, ENTER
)
doClick(int pressTime) to visually paints action as information to user, painting isPressed
to the screen, miliseconds from JVM returns me very closely number (1999 - 2001 for doClick(2000))
very low number at 68miliseconds haven't any screen effect, because isn't catchable by humans eyes, maybe most of LCD / LED monitors can't repaint this painting artefact correctly,
answer by @Michael Dibbets is closer to setMultiClickThreshhold(long threshhold),
© 2022 - 2024 — McMap. All rights reserved.