Article View: borland.public.jbuilder.java.swing
Article #190Re: GridBagLayout - strange behavior?
From: Paul Furbacher [TeamB]
Date: Fri, 08 Sep 2006 21:40
Date: Fri, 08 Sep 2006 21:40
82 lines
3847 bytes
3847 bytes
If you included the actual code (stripping down to just
what you show below), it would be a lot easier for one
of us to pull it into a little test project and play
with it. As it is, I don't have the time to translate
the table below into code, but if I had the code, it
would take a minute or two to see what is happening and
what the remedy might be.
I'm suspicious of the -3 and odd paddings -- I rarely
use any padding. The extreme insets.right are also something
I would avoid. My feeling on the latter is that in most
cases they should be in the range of 8 - 12 px at most, and
balanced. Other methods for displacing far to the left or
right should be used instead.
Magnus wrote:
> Hi,
>
> I have a "strange behavior" in 2 of my windows (JFrame) on WInXP running
> JRE1.4.
>
> Example - one panel have (GBL) Grid: 5 across and 4 down
>
> Top row looks like:
>
> RadioButton1 (RB1), RB2, label, JComboBox, empty
>
> Constraints
> Grid Ext Insets Padd Weight Anchor Fill
> components X Y W H T L B R W H X Y
> ---------- - - - - -- -- - --- --- -- - - ------ -----
> RB1 0 0 1 1 39 40 0 0 9 -3 0 0 Center None
> RB2 1 0 1 1 39 0 0 103 23 -3 0 0 C N
> label 2 0 1 1 39 9 0 0 33 5 0 0 West N
> JCB 3 0 1 1 39 9 0 134 154 -1 1 0 C Horiz
>
> (All values were created in JBuilder from XY-Layout)
>
> The problem: If a value (visible or down the list not visible) in the
> JCB is large (>17 char) the label that is for RB2 is cropped. Some
> changes below in the panel does also happens but what I don't understand
> is why only the RB2 label is affected and not anything else on that "row".
>
> Note: There is plenty of space in the JCB to display the full string (up
> to 50 char).
>
> Tests:
> 1) If I remove the padding, the RB2 label is fine but the JCB doesn't
> display the full string.
>
> 2) Changing the JCB to
> JCB 3 0 1 1 39 9 0 0 0 0 1 0 W None
> creates a window that size everything according to the strings in
> JCB. Since the JCB is empty (populated from a DB) when in design mode it
> becomes hard to see the final size and layout.
>
> 3) I added a padding of W 120 and could now use a longer string but not
> full length (50 char).
>
> A constraint that I didn't play with is weightx but should not change
> anything unless I resize the pane, right?
>
> TIA,
>
> Magnus
--
Paul Furbacher (TeamB)
Save time, search the archives:
http://info.borland.com/newsgroups/ngsearch.html
Is it in Joi Ellis's Faq-O-Matic?
http://www.visi.com/~gyles19/fom-serve/cache/1.html
Finally, please send responses to the newsgroup only.
That means, do not send email directly to me.
Thank you.
Technical Details
Message-ID:
<4501e33d@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news2.volia.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<45018ac6@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 111d45,b9c2cd48df0ef75b X-Google-Attributes: gid111d45,public X-Google-Language: ENGLISH,ASCII-7-bit Date: Fri, 08 Sep 2006 17:40:26 -0400 From: "Paul Furbacher [TeamB]" <pfurbacher@mac.com> Organization: Reverse Alchemy, Inc. User-Agent: Thunderbird 1.5.0.5 (Macintosh/20060719) MIME-Version: 1.0 Newsgroups: borland.public.jbuilder.java.swing Subject: Re: GridBagLayout - strange behavior? References: <45018ac6@newsgroups.borland.com> In-Reply-To: <45018ac6@newsgroups.borland.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 69.142.194.228 Message-ID: <4501e33d@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1157751613 69.142.194.228 (8 Sep 2006 14:40:13 -0700) Lines: 82 Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news2.volia.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail