Getting A Sketch's Window's Position

Just adding a note for people deciding on whether to go the getNative() route: not only is it a renderer specific Object – a whatever-the-renderer-gives-us – but it could be subject to change. This is whimsically expressed in the Processing API documentation…

from PSurface.getNative :

Get the native window object associated with this drawing surface. For Java2D, this will be an AWT Frame object. For OpenGL, the window. The data returned here is subject to the whims of the renderer, and using this method means you’re willing to deal with underlying implementation changes and that you won’t throw a fit like a toddler if your code breaks sometime in the future.

2 Likes