From owner-freebsd-java Sat Mar 7 10:55:18 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id KAA05269 for freebsd-java-outgoing; Sat, 7 Mar 1998 10:55:18 -0800 (PST) (envelope-from owner-freebsd-java@FreeBSD.ORG) Received: from ns.mt.sri.com (sri-gw.MT.net [206.127.105.141]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id KAA05260 for ; Sat, 7 Mar 1998 10:55:15 -0800 (PST) (envelope-from nate@mt.sri.com) Received: from mt.sri.com (rocky.mt.sri.com [206.127.76.100]) by ns.mt.sri.com (8.8.8/8.8.8) with SMTP id LAA13257; Sat, 7 Mar 1998 11:55:15 -0700 (MST) (envelope-from nate@rocky.mt.sri.com) Received: by mt.sri.com (SMI-8.6/SMI-SVR4) id LAA03817; Sat, 7 Mar 1998 11:55:13 -0700 Date: Sat, 7 Mar 1998 11:55:13 -0700 Message-Id: <199803071855.LAA03817@mt.sri.com> From: Nate Williams MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: "Simon J. Gerraty" Cc: freebsd-java@FreeBSD.ORG Subject: Re: JVM bug or user error? In-Reply-To: <199803071252.XAA01494@zen.quick.com.au> References: <199803071252.XAA01494@zen.quick.com.au> X-Mailer: VM 6.29 under 19.15 XEmacs Lucid Sender: owner-freebsd-java@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org > I have been testing some awt behaviour in my native NetBSD jdk (uses > lesstif), The reason I'm posting here is that the current FreeBSD JDK > using Motif shows the same behaviour (bug?). Note that real apps so > far have worked fine with the FreeBSD JDK on NetBSD. Glad to hear it. > Since all my tests were run on a NetBSD-1.3 box I would appreciate > it if someone could compile the app and run it on a FreeBSD system. Done. > Below is a simple test app which should throw up a username/passwd > dialogue. It is hacked from modeFrame11.java from the Java AWT Reference > book from O'Reilly & Assc. The changes made are simply to allow its > behviour to be changed at runtime. > > Basically if you compile modeFrameL.java and run > > java modeFrameL > > this explicitly calls resize(250,125) and you get: > > getPreferredSize(): x=0, y=0 > > printed out, and a correctly sized popup window. > > If you run "java modeFrameL a", it skips resize() and calls pack(), > you now get: > > getPreferredSize(): x=217, y=102 > > and a 2x2 sized popup! > > If you run "java modeFrameL a b", it does the resize() followed by > pack() and you get: > > getPreferredSize(): x=217, y=102 > > and a reasonably sized popup. Is the popup window the one with the OK button in it, or the window that happens after you hit OK? In any case, I get the following behavior (which all seems to work), using the JDK I built that should be the same one that I stuck on FreeBSD's JDK WWW page for download. caddis:~/InCON/SRI/base/SIData % java modeFrameL getPreferredSize(): x=0, y=0 ^C caddis:~/InCON/SRI/base/SIData % java modeFrameL a getPreferredSize(): x=227, y=132 ^C caddis:~/InCON/SRI/base/SIData % java modeFrameL a b getPreferredSize(): x=227, y=132 ^C However, all of the frames have the exact same size (both the original username/password one and the subsequent frame that stays up afterwards.) > What is going on? It appears that getPreferredSize() returns 0x0 > until pack() has been called. Yep, this is 'expected' behavior unless you explicitly give the component a size. > Which is interesting as one of the > things that pack() does is setSize(getPreferredSize()). In a couple of our components that have varied size in out application, we must over-ride getPreferredSize() to contain the largest size the component will be, since if we don't then resizer endds up with potentially bogus sizing information which never gets redone. (I suppose we could call pack() everytime something changed, but that alot and we've got enough problems with repaint performance already.) > Anyway, like I said, the surprise was that in this case the FreeBSD > JDK showed exactly? the same behaviour whereas for real apps dialogs > etc are sized ok. I don't see the bug. I haven't looked more closely into it than to just run the program and check the results (I haven't analyzed it as well as you have above), but I'm merely sharing my results and experiences with this program and Java/AWT in general. Nate To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-java" in the body of the message