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 discovered thru 
> experimentation 
> that sleeping the thread caused MY resize to take priority 
> over (what I 
> assume to be) OSX's resize. Twenty milliseconds does it for me (ten 
> *ususally* works) but that is probably variable.
> 
> If there is a prescribed way to do this, I'd be keen to know.

If you haven't already tried it, give SwingUtilities.invokeLater to
schedule the resize instead of Thread.sleep.  Sleeping the Swing thread
is generally going to be a bad idea but invokeLater will just schedule
the resize to occur later (after the current event has finished).  Might
be more robust.

I tried the following code which worked pretty smoothly but "felt
weird".  I think that's just because it only pays attention to the
component height and not whichever dimension is closest (so if I drag to
the right the height and width should increase but with the current code
the window size remains constant).

Regards,

Adrian Sutton.
 _______________________________________________
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



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.