Article View: borland.public.jbuilder.java.swing
Article #189GridBagLayout - strange behavior?
From: Magnus
Date: Fri, 08 Sep 2006 15:22
Date: Fri, 08 Sep 2006 15:22
49 lines
2598 bytes
2598 bytes
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
Technical Details
Message-ID:
<45018ac6@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 111d45,b9c2cd48df0ef75b,start X-Google-Attributes: gid111d45,public X-Google-Language: ENGLISH,ASCII-7-bit Date: Fri, 08 Sep 2006 11:22:54 -0400 From: Magnus <magnus_bjorkman@yahoo.com> User-Agent: Thunderbird 1.5.0.5 (Windows/20060719) MIME-Version: 1.0 Newsgroups: borland.public.jbuilder.java.swing Subject: GridBagLayout - strange behavior? Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 24.149.234.69 Message-ID: <45018ac6@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1157728966 24.149.234.69 (8 Sep 2006 08:22:46 -0700) Lines: 49 Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail