We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello everyone.
I have recently been experimenting with window resizing (to answer someone's question). The question asked about how to disable the maximize button, and I came up with this:
if(frame.getExtendedState() == 6) {
setExtendedState(0);
}
The code will change the sketch from maximized to normal as soon as it realizes that the sketch has been maximized. Only one problem: It's very buggy. After clicking the maximize button a few times, you'll notice you can't do anything to the sketch window any more. In addition to that, you can see the window resizing for a fraction of a second before going back to normal. My question is: Is there a more efficient (and less buggy) way of "disabling" the maximize button.
Thanks in advance,
-- MenteCode
Answers
I believe some methods of the Frame class (or its parent classes, like Window) allows to control what buttons can be displayed in the frame, IIRC.
Most people on other Java forums have replied to people with the same question, saying to use JDialog, or JInternalFrame, and other Swing classes that I have missed. The original Frame class, however (maybe I'm wrong), doesn't show anything about editing frame GUI buttons.
Guess I'll have to look further.
Processing uses AWT, not Swing. And variable frame holds the instantiated object of it! :o3
So I'm afraid that anything else wouldn't be able to control Processing's window! 8-|
I just meant to say that the only way people have suggested to remove these buttons is through Swing, even though its pure Java, but you're right.
And because Processing and Swing don't mix so well, so I presume that my code is currently the only way of disabling the maximize button in Processing. >:P
-- MenteCode