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: setMinimumSize



Rob Ross wrote:

It's not a Mac thing, it's a Java thing. Sadly, Java still does not handle this very well. You'll notice there is no setMinimumSize() method in JFrame. This would solve this problem, but as yet, there is no such API.

The best thing you can do, and it truly is a kludge, is either set the window's resizable property to false (setResizable(false), no resizing allowed *at all*, so no way for the window to be made smaller), or add a component listener, and "undo" any attempts to resize the window smaller than you want it to be. Neither solution is very professional in my opinion, and this has been one of my pain points with Swing/AWT for quite a while.

You could also implement your own resizing behaviour. Disable the default resize behaviour, then add a MouseMotionListener, and if the mouse is dragged inside the resize handle, adjust the size of the frame as *you* see fit. I had to do this to get a resizable unadorned window, but it should work with an adorned one too. You'll have to draw your own resize handle.

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