Re: GridBagLayout - strange behavior?

From:"Paul Furbacher [TeamB]" [pfurbacher@masked-domain]
Sent on:Fri, 08 Sep 2006 17:40:26 -0400
In reply to:GridBagLayout - strange behavior? sent on Fri, 08 Sep 2006 11:22:54 -0400 by Magnus [magnus_bjorkman@masked-domain]
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.

Other messages in this topic

SenderDate sentSubject
Magnus [magnus_bjorkman@masked-domain]Fri, 08 Sep 2006 11:22:54 -0400GridBagLayout - strange behavior?

 
Found what you were looking for? If not - continue at Wiki Index
Recent changes | RSS changes | Table of contents | News Archive | Terms And Conditions | Register