A problem with knowing if a window is minimized

Hi, I am new to here. I need to know if the main window is minimised.
Full problem: I have a multi window G4P project and if the main window is minimized, I want to minimize others(G4P windows), I want them to act as one window when minimizing and maximizing.
I have found this on the old forum, am not sure if this question has already appeared on the new forum. The problem is that frame.getExtendedState() doesn’t work, I’m using Processing v 3.5.4.