How to close the program on exit? I end up with a dozen windows because I tend to forget to close the window.
Welcome to the forum.
You need to provide more information for us to help you for instance -
- Programming IDE e..g. Processing, Eclipse, VSC …
- Processing version e.g. 4.5.6
- Programming mode e.g. Java, p5.js, Python
- Are the windows created from a single sketch in which case how do you create them
There are probably other questions that might need answering later.
In the meantime I suggest you read the forum guidelines on asking questions.
![]()
Eclipse IDE 2024.06
Java 21
I meant the actual configuration on the frame that automatically closes the window when I end the program, I know swing lets you do this with JFrames, but I’m not sure if Processing allows you to do this
I think I know what you mean, in Eclipse if you ‘run’ the sketch multiple times you get multiple windows open but Eclipse only ‘links’ to the last one so closing it by clicking on the little red square would close that one and leave the rest which can’t be closed from Eclipse.
Its been a while since I used Eclipse but I did experience this but found no ideal solution, I simply clicked on each window and pressed the key to close it.
-
How are you ending the program?
-
Normally when the Processing window is closed it quits the app. The default window is a JFrame. Which renderer are you using. Which operating system?
-
frame = (javax.swing.JFrame) ((processing.awt.PSurfaceAWT.SmoothCanvas) surface.getNative()).getFrame(); -
Any way to post code that we can run in Eclipse to demonstrate the problem?
If you are ending the program programmatically add
public void exit(){
super.exit();
}
in the class that extends PApplet and then call the exit method when you want to close the sketch window.
(post deleted by author)