We are about to switch to a new forum software. Until then we have removed the registration on this forum.
In the example: Demos > Tests > MultipleWindows
I would like to create a child window which does not close the main window when closed. The purpose is to have an inspection window which will be created for a short time, then closed, and then something else is inspected. My hunch is that it's something with JFrame if I'm not confused, but I probably am because I can't find anything.
After using the G4P library, I've noticed that after about three to seven windows are created and closed in procession, my entire computer starts going very slowly, but my resource monitor shows nothing specific. So, I'm looking to build the windows from scratch to see if it's any different or if it's my computer.
Answers
https://forum.Processing.org/two/discussions/tagged?Tag=papplet.runsketch()
I said I searched everywhere. Where is the reference for runScetch()? That's what I'm looking for, not some pile of kid's spaghetti.
Performing a find text on the page GitHub:core:src:PApplet.java for runScetch doesn't find anything.
Multiple windows is literally the most important feature of the whole desktop concept, it's why we don't use command prompts anymore...
Why is this foundation feature for learning computer programming absent from an API designed to ease learning/using programming? This is bizarre and frustrating.
If you search for the wrong thing you won't find it ;) . Search for runSketch NOT runScetch if you do that you will find the comments describing the arguments between lines 9926 and 9996 in PApplet
HAHAHAHAH damnit :D
After reading it, it's not obvious to me how you got only the child window to close in the G4P library.
With great difficulty and it is different for JAVA2D and P2D/P3D
To start with the arguments for
runSketch
do not affect how Processing deals with clicking on the window close icon (red cross).You have to remember that Processing is designed to create single-window sketches. So when a window is created with runSketch Processing adds a window listener to it which terminates the application when the user closes the window.
Libraries like G4P that create multiple windows using runSketch either accept that the application terminates if any of the windows is closed or has to remove the listener added by Processing then create and add a new window listener which closes the extra window without terminating the application.
G4P takes this one step further by allowing the user to choose what happens when the user clicks on the window close icon. It can be
1) Ignore and keep the window open
2) close the window
3) terminate the application (same as Processing)
The code to do this is fairly advanced stuff, which is why it is hidden away inside G4P so the user doesn't have to worry about it. :)
Hmmmm....
Do you have any idea why after a few window create/close cycles makes my entire computer slow down? The program becomes inoperable too quickly.
It's pretty standard, and seems like it's what you were telling me to do in the other thread.
Have you tried doing this with the Mandelbrot example that comes with G4P
It could be that the resources are not being released properly. Generally I don't close a window if I want to open it again (or reuse it) later I simply make it invisible.
The mandlebrot example does make some serious slowdown after ~6 windows into it. However, mine is slowing down much greater after the first windows. The specific function that is slowing down is selectFolder(). I'm loading data, processing the data, then visualizing it. After the images are saved, a new folder is selected. After a couple of these cycles, the selectFolder window begins lagging out really, really badly, the Windows min/max/close buttons and Window Pane movement is also slow.
Sometimes (not always under same procedure) G4P throws: "Exception while removing reference."
The only data that isn't temporary is located in the main sketch, being the ArrayList alDataList and PImage heatHL.
I'll try the invisible setting to see if anything improves.
Interesting because on my computer I can have over 20 windows open without any noticeable slowdown. :)
The select??? methods in G4P and Processing use the standard Java dialog boxes so I don't see why the should slow down. Can you post a simple sketch that demonstrates the problem?
ding graphics card driver problems. Looks like I'm buying a new card then. This one wasn't designed for Windows7 compatibility and has a few MB of memory. That's why it didn't show up on the resource monitor. Well, at least I'm comfortable with this as it has nothing to do with either the API or my programming.
I am very grateful for your support quark. Thank you very much. :)