 <p>First, you have to get the instance holding your sketch. That means using the <code>runSketch()</code> function instead of calling <code>main()</code> directly:</p> <pre><code>Game game = new Game(); String[] args = {}; PApplet.runSketch(args, game); </code></pre> <p>Now that you have a reference to your sketch instance, you can use it to get to the internal window. How you do this depends on which renderer you're using, but you can figure it out using a mix of <a href="http://processing.github.io/processing-javadocs/core/" rel="nofollow noreferrer">the Processing JavaDoc</a> and <a href="https://github.com/processing/processing/tree/master/core/src/processing" rel="nofollow noreferrer">the Processing source code</a>.</p> <p>Here's an <strong>untested</strong> example using the default renderer:</p> <pre><code>PSurface surface = game.getSurface(); SmoothCanvas smoothCanvas = (SmoothCanvas)surface.getNative(); JFrame frame = (JFrame) smoothCanvas.getFrame(); </code></pre> <p>Now that you have the parent window, you can do whatever you want with it, including:</p> <pre><code>frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); frame.setVisible(false); </code></pre> <p>Like I said I haven't tested this code, and this is going to depend on exactly which renderer you're using, but this process of using the source code and JavaDoc to figure out what's going on under the hood to get to the underlying window is what you have to do.</p>