Reputation:
In JavaFx, is there any reliable way to know at what time an event was posted ?
And since this question is too short for stackoverflow, I elaborate somwhat. In asychronous event systems, which I believe javafx is, events get posted on a queue and then at a later stage handled. The time between posting and handling is unknown, allthough it is estimated to be small. Nevertheless, there are no guarantees that this time is indeed small. Therefor I would really like to know whether it is possible to know the time of posting the event. E.g: when the user actually clicked the button (as opposed to when the program looks at it).
Upvotes: 0
Views: 152
Reputation: 3407
Short answer: no.
According to JavaFX Architecture it uses the native event queue for capturing and batching all the events. By capturing it is understood that at that moment in time the event was generated (the user clicked the button). Taking batching into account we have already lost the information about the time the event was generated (unless JavaFX internally keeps that information, you can inspect com.sun.javafx
packages for lower level details). Every 1/60th of a second there is a scheduled pulse event. During the pulse event all other JavaFX events like MouseEvent, etc. are fired via the normal JavaFX event dispatching mechanism. It is at this point that your application will receive a notification from JavaFX that an event has occurred. So in an ideal world the difference between the time an event was posted and the time it was handled should be < 0.0166(6) seconds.
Upvotes: 1