Skip to main content

Finding the restored bounds of a maximised window

1 reply [Last post]
Joined: 2005-08-17

I am trying to save the state of a frame so that it can be restored the next time the application is run.

If I query the bounds and the extendedState of the frame it works find if the frame is in normal or iconified state.

When the frame is maximised, getBounds returns the maximised bounds of the frame.

Is there any way to get the "restored" bounds when a frame is maximised?

I've tried setting the extended state to normal, querying the bounds and then reset to maximised, but it's a bit flickery.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2003-06-13

I suggest you look at a couple of widgets from the UICompiler project; they provide the functionality you are looking for.

Its the StandardDialog and the MainWindow classes. They have show methods with a location and rectangle; and getters so you can request the sizes at any time.

in the api docs you can find these in the uic.widgets package
I do think you have to use the snapshot from the downloads page as this stuff got some good bugfixes since the last stable release.