G4P (GUI for Processing)
4.3.8
A set of GUI controls for your Processing sketch.
|
Public Member Functions | |
int | getInitialDelay () |
int | getInterval () |
int | getNbrRepeats () |
GTimer (PApplet theApplet, Object obj, String methodName, int delay) | |
GTimer (PApplet theApplet, Object obj, String methodName, int delay, int initDelay) | |
boolean | isRunning () |
boolean | isValid () |
void | setDelay (int delay) |
void | setInitialDelay (int initDelay) |
void | setInterval (int interval) |
void | setNbrRepeats (int nbrRepeats) |
void | start () |
void | start (int nrepeats) |
void | stop () |
Protected Member Functions | |
void | createEventHandler (Object handlerObj, String methodName) |
void | fireEvent () |
Protected Attributes | |
final PApplet | app |
Method | eventHandlerMethod = null |
String | eventHandlerMethodName |
Object | eventHandlerObject = null |
int | nbrRepeats = -1 |
Timer | timer = null |
Additional Inherited Members | |
![]() | |
int | ALL_METHOD = 0x0000001f |
int | CLIP_RUN = 512 |
int | COMBI_MODES = 768 |
String | DEFAULT_SLIDER_STYLE = "grey_blue" |
int | DRAG_CONTROL = 3 |
int | DRAW_METHOD = 0x00000001 |
char | EOL = '\n' |
int | EXCP_IN_HANDLER = 0xff000005 |
int[][] | grid |
int | GROUP_CONTROL_METHOD = DRAW_METHOD | MOUSE_METHOD | KEY_METHOD |
int | I_CL = 4 |
int | I_COVERED = 32 |
int | I_CR = 8 |
int | I_INSIDE = 16 |
int | I_MODES = 63 |
int | I_NONE = 0 |
int | I_TL = 1 |
int | I_TR = 2 |
int | INVALID_PAPPLET = 0xff000004 |
int | INVALID_TYPE = 0xff000003 |
int | KEY_METHOD = 0x00000008 |
int | MERGE_RUNS = 256 |
int | MISSING = 0xff000001 |
int | MOUSE_METHOD = 0x00000002 |
int | NONEXISTANT = 0xff000002 |
int | OFF_CONTROL = 0 |
int | OVER_CONTROL = 1 |
BasicStroke | pen_1_0 = new BasicStroke(1, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND) |
BasicStroke | pen_2_0 = new BasicStroke(2, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND) |
BasicStroke | pen_3_0 = new BasicStroke(3, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND) |
BasicStroke | pen_4_0 = new BasicStroke(4, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND) |
int | POST_METHOD = 0x00000010 |
int | PRE_METHOD = 0x00000004 |
int | PRESS_CONTROL = 2 |
int | SCROLLBAR_HORIZONTAL = GConstants.SCROLLBARS_HORIZONTAL_ONLY |
int | SCROLLBAR_VERTICAL = GConstants.SCROLLBARS_VERTICAL_ONLY |
String | SLIDER_STYLES = "|grey_blue|blue18px|green_red20px|purple18px|red_yellow18px|" |
int | TINT_FOR_ALPHA = 255 |
int | TPAD2 = 2 |
int | TPAD4 = 4 |
int | TPAD6 = 6 |
int | TPAD8 = 8 |
float | WHEEL_DELTA = 0.01f |
float | WHEEL_STICK_FACTOR = 0.51f |
int | Z_PANEL = 1024 |
int | Z_SLIPPY = 24 |
int | Z_SLIPPY_EXPANDS = 48 |
int | Z_STICKY = 0 |
This class is used to trigger events at user defined intervals. The event will call a user defined method/function. The only restriction is that the method used has a single parameter of type GTimer and returns void eg
void fireBall(GTimer timer){ ... }
Each timer object must have its own handler
It has no visible GUI representation so will not appear in the GUI.
g4p_controls.GTimer.GTimer | ( | PApplet | theApplet, |
Object | obj, | ||
String | methodName, | ||
int | delay | ||
) |
Create the GTimer object with this ctor.
'methodName' is the method/function to be called every 'interval' milliseconds. 'obj' is the object that contains the method/function 'methodName'
For most users 'methodName' will be in their main sketch so this parameter has the same value as 'theApplet'
theApplet | a reference to the PApplet object (invariably this) |
obj | the object that has the method to be executed (likely to be this) |
methodName | the name of the method to be called by the timer |
delay | the initial delay and the time (in millisecs) between function calls |
g4p_controls.GTimer.GTimer | ( | PApplet | theApplet, |
Object | obj, | ||
String | methodName, | ||
int | delay, | ||
int | initDelay | ||
) |
Create the GTimer object with this ctor.
'methodName' is the method/function to be called every 'interval' milliseconds. 'obj' is the object that contains the method/function 'methodName'
For most users 'methodName' will be in their main sketch so this parameter has the same value as 'theApplet'
theApplet | a reference to the PApplet object (invariably this) |
obj | the object that has the method to be executed (likely to be this) |
methodName | the name of the method to be called by the timer |
delay | the time (in millisecs) between function calls |
initDelay | the initial delay (in millisecs) before calling method |
|
protected |
See if 'obj' has a method called 'methodName' that has a single parameter of type GTimer and if so keep a reference to it.
obj | |
methodName |
|
protected |
Attempt to fire an event for this timer. This will call the method/function defined in the ctor.
int g4p_controls.GTimer.getInitialDelay | ( | ) |
Get the initial delay time (milliseconds).
int g4p_controls.GTimer.getInterval | ( | ) |
Get the interval time (milliseconds) between events.
int g4p_controls.GTimer.getNbrRepeats | ( | ) |
The number of times an event is to be fired.
boolean g4p_controls.GTimer.isRunning | ( | ) |
Is the timer running?
boolean g4p_controls.GTimer.isValid | ( | ) |
See if the GTimer object has been created successfully
void g4p_controls.GTimer.setDelay | ( | int | delay | ) |
Sets the initial delay and the interval between events.
This is equivalent to calling both -
setInterval(delay); setInitialDelay(delay);
delay | initial delay and interval in milliseconds |
void g4p_controls.GTimer.setInitialDelay | ( | int | initDelay | ) |
Set the delay before the first event is triggered
initDelay | initial delay in milliseconds |
void g4p_controls.GTimer.setInterval | ( | int | interval | ) |
Set the interval between events
interval | delay between events in milliseconds |
void g4p_controls.GTimer.setNbrRepeats | ( | int | nbrRepeats | ) |
The number of times an event is to be fired.
nbrRepeats | ≥ 0 keep running until stopped by user |
void g4p_controls.GTimer.start | ( | ) |
Start the timer (call the method forever)
void g4p_controls.GTimer.start | ( | int | nrepeats | ) |
Start the timer and call the method for the number of times indicated by nrepeats. If nrepeats is ≤0 then repeat forever
nrepeats | the number of times to repeat the action |
void g4p_controls.GTimer.stop | ( | ) |
Stop the timer (can be restarted with start() method)