improvement maximize method from Panel