Article View: borland.public.jbuilder.java.language
Article #19075Re: GridBagLayout Problem
From: Conrad Hoesle-Kienzlen
Date: Thu, 12 Mar 1998 00:00
Date: Thu, 12 Mar 1998 00:00
47 lines
2704 bytes
2704 bytes
Howard, since I have experimented with GridBagLayout quite a bit, here is my opinion on it: it is only for rocket scientists. No ordinary human being can understand the intricacies of that layout manager without a 3 year university course given by at least 2 nobel prize winners. One thing that my "studies" have brought up is: in a GBL, one component should have weight=1.0 and it does not matter too much what weight the other components have (this is only an experience after much experimenting, don't ask me any finer points). The thing to do is, use XYLayout. GBL is just a partial failure to make things look nice when the user resizes the applet. I say: don't give a damn! If the user resizes the applet, he should take the consequences! GBL has it's uses in very simple cases. I, f.i. have made a bean for multi-line dialog boxes. Each line is added to the dialog as a label in a GBL. This way, I don't have to worry about the placement of the new laqbel, GBL does that for me. As for more complicated stuff - avoid it. Cheers, ... Conrad Howard Weiner wrote: > I have an application that displays a dialog box with a series of field > label/text field (and textarea) pairs. The frame itself is managed by the > FlowLayout manager. The field labels are added to a panel managed by the > GridBagLayout, and the text fields are added to another panel managed by the > GridBagLayout. > > Both "columns" appear as expected. The labels match up with the text > fields....except when the last text field is replaced by a text area. Then a > strange thing happens. The labels appear CENTERed within the column, and no > longer line up on the same horizontal axis as their corresponding text > fields and text area. > > First question: Why does one panel (for labels), managed by its own instance > of a GridBagLayout and GridBagConstraints effected by another with its own > instance set (text fields and text area)? > > Second question: Is this a language bug? > > Third question: Can anyone suggest a work-around other than replacing the > text area with a text field--which, by the way, makes the problem go away? > > TIA > > HDW
Technical Details
Message-ID:
<35083EAD.FF8D90B7@csi.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<6e9auk$dlr3@forums.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,5e716734f488574d X-Google-Attributes: gidf74b3,public From: Conrad Hoesle-Kienzlen <Conrad_Hoesle@csi.com> Subject: Re: GridBagLayout Problem Date: 1998/03/12 Message-ID: <35083EAD.FF8D90B7@csi.com> X-Deja-AN: 333432780 Content-Transfer-Encoding: 7bit References: <6e9auk$dlr3@forums.borland.com> Content-Type: text/plain; charset=us-ascii Organization: CHK IT-Consulting Mime-Version: 1.0 Newsgroups: borland.public.jbuilder.java.language