GView API

Handling Events

Although this class receives mouse events from Processing it does not have publically available event handlers. Instead it converts the event to a 'view local' event and forwards it to the listener.

The GView can be used without a listener but then it will not respond to mouse events.

Constructors

Constructor Description
GView (PApplet theApplet, 
     float p0, float p1, 
     float p2, float p3, 
     String renderer)
In most sketches the first parameter will have the value this to represent the main sketch widow.
The 4 float parameters will be the [x, y, width, height] of the view area.
The last will be the renderer to use i.e. JAVA2D, P2D or P3D>

Listeners

A GView control can only have one listener and a listener can only hear one view.

Mthod Description
void addListener(GViewListener listener)
Add the listener to this view
void removeListener(GViewListener listener)
Remove the current listener from this view
GViewListener getListener()
Returns the listener for this view or null if no listener is currently attached.

Public methods

Method Description
boolean isOver()
Returns true if the mouse is over the view else returns false
int width()
int height()
returns the width and height of the view.
boolean is3D()
Returns true if using the P3D renderer else returns false.
PGraphics getGraphics()
Returns the graphics object associated with this view.