Skip to main content

Finding the restored bounds of a maximised window

1 reply [Last post]
xprogrammer
Offline
Joined: 2005-08-17
Points: 0

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.
zander
Offline
Joined: 2003-06-13
Points: 0

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.

See: http://uic.sf.net
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.

Cheers!