Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AWT Frame with constant height-width ratio



I should have given more details about what I tried before arriving on the solution which worked.

* I did try to intercept the resize in the first place by overriding reshape() (which is the result of calls to setSize(), resize(), etc) but my intercept method was not called when the window corner was dragged. I infer that there is some kind of native resize happening. Intercepting the original resize call would be my preferred way of solving the problem if possible, because it would probably look a lot better to the user.

* I also did try to use SwingUtilities.invokeLater() but, unlike Adrian, that did not work for me. Originally I inferred that the delay caused by invokeLater() was insufficient on my machine to cause my resize to happen after, and take priority over, the OS resize. That's complete conjecture, though, since I know very little about how the underlying native window manager interacts with AWT.

I agree that those solutions would be better than the one I offer, which is not only a hack but quite an untidy hack. I tried both those ways, and a number of variations, before I came to the solution that worked for me.

I also agree that my resize routine could be a bit smarter, so that it resizes based on the closer proportioned edge. That's just laziness on my part, and isn't really the important pointer I wanted to pass on.


peace Nicholas

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden
References: 
 >AWT Frame with constant height-width ratio (From: "Nicholas R. Rinard" <email@hidden>)
 >Re: AWT Frame with constant height-width ratio (From: Moises Lejter <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.