Hi,
I’m running (Java) Processing on a Mac and I would like to be able to set the black tiny dot inside the red Close Window dot when my application is “modified”. Any ideas on how to manage that?
Thanks
Hi,
I’m running (Java) Processing on a Mac and I would like to be able to set the black tiny dot inside the red Close Window dot when my application is “modified”. Any ideas on how to manage that?
Thanks
Hello @Svedblen
Can you share more details and explain what exactly you are trying to accomplish? Thanks!
The application window frame, including the red, amber and green dots are managed by macOS and not the Processing IDE. I would expect it would be difficult to do what you want from inside Processing.
Personally I have no idea how you might achieve your objective.
Hi @Svedblen,
Can’t test, but you can try …
Cheers
— mnse
import javax.swing.*;
import processing.awt.*;
JFrame frame;
void setup() {
frame=(JFrame) ((PSurfaceAWT.SmoothCanvas)getSurface().getNative()).getFrame();
}
void mousePressed () {
frame.getRootPane().putClientProperty("windowModified",true)
}
void draw() {
background(128);
}
PS: @sableRaph: guess he mean to set the window to dirty state…
Aaaah I guess you’re right!
I tried your code on macOS Monterey and it doesn’t seem to work
Hi @sableRaph,
Would you please try again with: "JComponent.windowModified"
And maybe also set to Boolean.TRUE
.
So in length:
frame.getRootPane().putClientProperty(“JComponent.windowModified”,Boolean.TRUE);
Cheers
— mnse
Thanks @mnse, I tested it, but as @sableRaph said it does not work. It compiles and it runs but the red dot is unaffected.
Sorry, “JComponent.windowModified” does not do it either.
@sableRaph, as for what I’m trying to accomplish. I have a sketch where some data, read from a file, is shown to the user. The user can modify that data and if he/she does I want the red dot to indicate “unsaved” data, which the user preferable should save before exiting. As per normal for a Mac application.
Hi,
As said, can’t test further. Traced several java code for MacOs which doing it exactly that way !?
Maybe one with a Mac can do further analysis…
Sorry and Cheers
— mnse
Hi @Svedblen,
Ok! One last try …
Found on the processing source itself, after I’ve spotted the black dot in the image posted by @sableRaph, where the PDE shows it …
frame.getRootPane().putClientProperty("Window.documentModified", Boolean.TRUE);
Cheers
— mnse
PS:
PPS: Also to set it with a Boolean Object is important.
Well done @mnse your perseverance has paid off and it worked on my mac.
Just out of interest do you know what effect this has in Windows and Linux?
Great work @mnse! It works like a charm! Thanks a lot.