# Sharing Image variables between PApplets

**URL:** <https://discourse.processing.org/t/sharing-image-variables-between-papplets/19877>\
**Category:** Libraries\
**Created:** [April 17, 2020, 9:31pm UTC](https://discourse.processing.org/t/sharing-image-variables-between-papplets/19877 "2020-04-17T21:31:11Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [May 12, 2020, 9:35pm UTC](https://discourse.processing.org/t/sharing-image-variables-between-papplets/19877/8 "2020-05-12T21:35:53Z")

</div>

Okay, here are resources on the PApplet exit issue:

> [@Prevent one Processing window from closing others](https://discourse.processing.org/t/prevent-one-processing-window-from-closing-others/13719/5):
>
> I’ve done some digging – inspired by @GoToLoop and @quark – and have found a solution. Closing sketches in P2D and JAVA2D renderer modes calls the PApplet instance’s exitActual() method, which contains the line System.exit(0) – a static method – which terminates the currently running Java virtual machine. Overriding exitActual() with nothing (i.e. preventing the call to System.exit(0)) prevents sketches from closing others, fixing the issue, but introduces another problem in the case of P2D s…

> [@Closing a second window](https://discourse.processing.org/t/closing-a-second-window/381):
>
> I want to be able to create a second window. The problem is I want the user to be able to close the second window, but doing so closes both the second and main frame. Is there a way I can prevent this? PWindow win; public void settings() { size(320, 240); } void setup() { win = new PWindow(); } void draw() { background(255, 0, 0); fill(255); rect(10, 10, frameCount, 10); } void mousePressed() { println("mousePressed in primary window"); } class PWindow extends PApplet { PWi…

…

For sharing images between PApplets, see also:

> [@Sharing objects between multiple PApplets - Processing in Eclipse - runSketch()](https://discourse.processing.org/t/sharing-objects-between-multiple-papplets-processing-in-eclipse-runsketch/9427):
>
> hello, I am using Processing (3.2.3) in Eclipse and I have managed to produce a second PApplet window using using runSketch(). I would like to use the second window to control what goes on in the first (and vice versa as well) - so use PApplet 2 to control what’s going on in PApplet 1. I am not new to Processing but I am new to Eclipse and using full Java. So I am wondering how I may access classes which are being used by the other applet - ie. how would different PApplets share objects? Below …

---

_[View the full topic](https://discourse.processing.org/t/sharing-image-variables-between-papplets/19877)._
