Can I set JFrame's normal size while it is maximized?
Posted
by
icza
on Stack Overflow
See other posts from Stack Overflow
or by icza
Published on 2012-12-17T10:51:05Z
Indexed on
2012/12/17
11:03 UTC
Read the original article
Hit count: 138
I'd like to set the normal size of a visible JFrame
while it is in Frame.MAXIMIZED_BOTH
state (by normal size i mean the size of frame when it is in Frame.NORMAL
state) .
The reason I want to do this is so that when the user un-maximizes the frame, it will have the proper size I want it to be. But if I do so, the window will switch to normal state.
If I set the size first, then switch to MAXIMIZED_BOTH
state, then I will see a disturbing blink or resize (which I don't want to).
I've also tried setting the size first, then changing state to MAXIMIZED_BOTH
, and then making it visible, but the state change is deferred if the window is not visible (and will only be executed once it is made visible, also resulting in a visual resize).
So what can I do if I want my frame to have a predefined normal size, but I want it to appear maximized?
© Stack Overflow or respective owner