0

When I create my JFrame, I start out with it maximized and in the center of the window using: setExtendedState(java.awt.Frame.MAXIMIZED_BOTH);
setLocationRelativeTo(null);

However, when I move my frame from the docked location to somewhere else on the screen, nothing happens when I try to resize/recenter it back to it's maximized location using the maximize button in the title bar. I'm on a Mac and clicking the green + button or double-clicking the title bar does nothing to affect the frame's state or location.

I can get it to recenter if I use a WindowStateListener to change the frame's size based on the state. But I would like to keep the frame the same size if moving it from the maximized state to a normal state.

Ultimately, what I'm trying to do is get my frame to register a new window size if it moves between different screen resolutions. So far, the issue I'm running into is the inability to resize/re-center to a similar resolution without adjusting the frame size itself.

ave8tor
  • 3
  • 2

0 Answers0