public interface PenListener
Modifier and Type | Method and Description |
---|---|
void |
penButtonEvent(PButtonEvent ev) |
void |
penKindEvent(PKindEvent ev) |
void |
penLevelEvent(PLevelEvent ev) |
void |
penScrollEvent(PScrollEvent ev) |
void |
penTock(long availableMillis)
Useful to detect if the listeners are taking too much time processing events (
availableMillis<0 ) causing pen lagging (pen events being queued at a higher rate than they are being processed). |
void penKindEvent(PKindEvent ev)
void penLevelEvent(PLevelEvent ev)
void penButtonEvent(PButtonEvent ev)
void penScrollEvent(PScrollEvent ev)
void penTock(long availableMillis)
availableMillis<0
) causing pen lagging (pen events being queued at a higher rate than they are being processed).
The pen fires queued events at a given frequency (by default Pen.DEFAULT_FREQUENCY
) in its own thread. Each cycle, after firing and processing the events, the pen calls jpen.event.PenListener.penTock(long availableMillis), where availableMillis is the time left of the period: availableMillis=period-firingTime
, period=1000/frequency
, and firingTime
is the time spent in firing and processing events in the cycle.
This method is called from the event dispatch thread if Pen.getFirePenTockOnSwing()
is true
.
Pen.setFirePenTockOnSwing(boolean)