public class PenAdapter extends java.lang.Object implements PenListener
Constructor and Description |
---|
PenAdapter() |
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). |
public PenAdapter()
public void penKindEvent(PKindEvent ev)
penKindEvent
in interface PenListener
public void penLevelEvent(PLevelEvent ev)
penLevelEvent
in interface PenListener
public void penButtonEvent(PButtonEvent ev)
penButtonEvent
in interface PenListener
public void penScrollEvent(PScrollEvent ev)
penScrollEvent
in interface PenListener
public void penTock(long availableMillis)
PenListener
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
.
penTock
in interface PenListener
Pen.setFirePenTockOnSwing(boolean)