Thread View: borland.public.jbuilder.java.swing
10 messages
10 total messages
Started by Magnus
Wed, 28 Sep 2005 13:27
Gridbaglayout display issue
Author: Magnus
Date: Wed, 28 Sep 2005 13:27
Date: Wed, 28 Sep 2005 13:27
30 lines
1932 bytes
1932 bytes
Hi,
I got a call from a tester who had problems finding a JComboBox on a
screen. He knew where it is located (usually) so he could click in the
black dot that showed and could then see the options.
What could have caused this to happen and what can I do to prevent this
and similar display "issues" in the future? Can this be caused by the
display setting for the computer. (WinXP)
Why only this box? I have other boxes that showed proper.
Magnus
--- not showing ---
JComboBox comPortComboBox = new JComboBox();
for (int i = 0; i < comPortList.length; i++)
comPortComboBox.addItem(comPortList[i]);
panel1.add(comPortComboBox, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0
, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
new Insets(28, 8, 0, 30), 14, -1));
--- showing ---
panel3.add(testComboBox, new GridBagConstraints(2, 2, 1, 1, 1.0, 0.0
,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
new Insets(0, 0, 0, 0), 25, -1));
Re: Gridbaglayout display issue
Author: Gillmer J. Derge [TeamB]
Date: Wed, 28 Sep 2005 13:54
Date: Wed, 28 Sep 2005 13:54
39 lines
2800 bytes
2800 bytes
Magnus wrote: > What could have caused this to happen and what can I do to prevent this > and similar display "issues" in the future? Can this be caused by the > display setting for the computer. (WinXP) Did he send you a screenshot? The first thing I always wonder about when I get a bug report is how many vital details have been left out of the report because they're "obvious" to the tester. It's rare that the number is zero. For example, did he resize the window to an odd size? Is he using a really huge or tiny font? Is he using a strange color scheme that makes the combo box blend in with the background? Is some other component sized strangely, making the grid cells the wrong size, and he didn't notice it? These are all things that would hit you in a second with a screenshot but that your tester will probably never tell you. Is he able to run the program in a way that opens a console window? You might see some kind of exception backtrace that will help explain the problem and where it's occurring. > Why only this box? I have other boxes that showed proper. ... > panel1.add(comPortComboBox, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0 > , GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, > new Insets(28, 8, 0, 30), 14, -1)); Two things hit me at first glance. First, you have fairly large insets, especially compared to the other component (all 0's). Maybe the combo box is getting squeezed out and doesn't have room. More likely it's the second issue though. The last argument to the GridBagConstraints constructor is "ipady." You're passing -1. The documentation doesn't explicitly prohibit negative values, but I doubt they're legal. Try 0 or 1 and see if that works better. -- Gillmer J. Derge [TeamB]
Re: Gridbaglayout display issue
Author: Magnus
Date: Wed, 28 Sep 2005 14:05
Date: Wed, 28 Sep 2005 14:05
48 lines
2863 bytes
2863 bytes
Gillmer J. Derge [TeamB] wrote: > Magnus wrote: > >> What could have caused this to happen and what can I do to prevent >> this and similar display "issues" in the future? Can this be caused by >> the display setting for the computer. (WinXP) > > > Did he send you a screenshot? The first thing I always wonder about > when I get a bug report is how many vital details have been left out of > the report because they're "obvious" to the tester. It's rare that the > number is zero. He did send a screenshot. All other (the window have 6 labels, fields and buttons in total) show normal. The window can not be re-sized. "Ordinary" fonts > Is he able to run the program in a way that opens a console window? You > might see some kind of exception backtrace that will help explain the > problem and where it's occurring. Sorry, no! >> panel1.add(comPortComboBox, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0 >> , GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, >> new Insets(28, 8, 0, 30), 14, -1)); > > > Two things hit me at first glance. First, you have fairly large insets, > especially compared to the other component (all 0's). Maybe the combo > box is getting squeezed out and doesn't have room. More likely it's the > second issue though. > > The last argument to the GridBagConstraints constructor is "ipady." > You're passing -1. The documentation doesn't explicitly prohibit > negative values, but I doubt they're legal. Try 0 or 1 and see if that > works better. > The window was created using the XYLayout and then "automatically" converted to GBL (as the tutorial recommends). I have done this for > 30 windows and only had to adjust a couple of times. That is where the -1 comes from (and all other arguments).
Re: Gridbaglayout display issue
Author: Paul Furbacher [TeamB]
Date: Tue, 04 Oct 2005 03:34
Date: Tue, 04 Oct 2005 03:34
25 lines
1846 bytes
1846 bytes
Paul Nichols [TeamB] wrote:
> Go back into your JFrame/JPanel and set the insets manually. You can do this
> with a right click.
You probably do it more quickly by grabbing
the blue handles of an object in the Designer.
The status bar gives you feedback on the value
of the inset. Very handy.
--
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.
Re: Gridbaglayout display issue
Author: Paul Nichols [TeamB]
Date: Wed, 05 Oct 2005 03:44
Date: Wed, 05 Oct 2005 03:44
18 lines
1450 bytes
1450 bytes
Magnus wrote: > Gillmer J. Derge [TeamB] wrote: > >> Magnus wrote: >> > > The window was created using the XYLayout and then "automatically" > converted to GBL (as the tutorial recommends). I have done this for > 30 > windows and only had to adjust a couple of times. That is where the -1 > comes from (and all other arguments). I would not use this combo. XY is vertainly not reliable, and GridBagLayout mappings from XY can only provide an approximation at best. Go back into your JFrame/JPanel and set the insets manually. You can do this with a right click.
Re: Gridbaglayout display issue
Author: Magnus
Date: Mon, 10 Oct 2005 15:30
Date: Mon, 10 Oct 2005 15:30
27 lines
2111 bytes
2111 bytes
Thanks! I have done this a couple of times when needed but at 90% I left everything as it was and, as far as I know, all other buttons, boxes, panels, labels etc. works fine. What I'm struggeling with is that I can't find out why this litle box doesn't show vs. the rest (in even more complex screens) and only for his install. We did check the display settings under "options" and found that it was "generic display" but again, why only this box? Paul Furbacher [TeamB] wrote: > Paul Nichols [TeamB] wrote: > >> Go back into your JFrame/JPanel and set the insets manually. You can >> do this >> with a right click. > > > You probably do it more quickly by grabbing > the blue handles of an object in the Designer. > The status bar gives you feedback on the value > of the inset. Very handy. > >
Re: Gridbaglayout display issue
Author: Paul Furbacher [TeamB]
Date: Mon, 10 Oct 2005 16:16
Date: Mon, 10 Oct 2005 16:16
30 lines
2351 bytes
2351 bytes
Magnus wrote:
> I have done this a couple of times when needed but at 90% I left
> everything as it was and, as far as I know, all other buttons, boxes,
> panels, labels etc. works fine. What I'm struggeling with is that I
> can't find out why this litle box doesn't show vs. the rest (in even
> more complex screens) and only for his install.
>
> We did check the display settings under "options" and found that it was
> "generic display" but again, why only this box?
Idea: temporarily add a focus listener to it (and maybe some
visible control near it in tab order) which reports the location
of the control to System.out when focus is gained.
--
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.
Re: Gridbaglayout display issue
Author: Magnus
Date: Mon, 10 Oct 2005 16:42
Date: Mon, 10 Oct 2005 16:42
29 lines
2363 bytes
2363 bytes
Sounds like a good approach. What do you mean by "reports the location of the control"? Do you have an example of what to show? We found another, again drop-down box, with problems but this time the box showed fine in size but the values showed up with ".." instead of "1", "2", etc. Since ".." is bigger than "1" this is also confusing. Paul Furbacher [TeamB] wrote: > Magnus wrote: > >> I have done this a couple of times when needed but at 90% I left >> everything as it was and, as far as I know, all other buttons, boxes, >> panels, labels etc. works fine. What I'm struggeling with is that I >> can't find out why this litle box doesn't show vs. the rest (in even >> more complex screens) and only for his install. >> >> We did check the display settings under "options" and found that it >> was "generic display" but again, why only this box? > > > Idea: temporarily add a focus listener to it (and maybe some > visible control near it in tab order) which reports the location > of the control to System.out when focus is gained. > >
Re: Gridbaglayout display issue
Author: Paul Furbacher [TeamB]
Date: Mon, 10 Oct 2005 22:35
Date: Mon, 10 Oct 2005 22:35
37 lines
2536 bytes
2536 bytes
Magnus wrote:
> Sounds like a good approach.
>
> What do you mean by "reports the location of the control"? Do you have
> an example of what to show?
I don't have an example but with any Swing or AWT component
you can ask it for its location. Also, try asking it what
size it is.
> We found another, again drop-down box, with problems but this time the
> box showed fine in size but the values showed up with ".." instead of
> "1", "2", etc.
> Since ".." is bigger than "1" this is also confusing.
Maybe the size of two dots is considered by the layout
mechanism to be smaller than any character. Don't know,
but that would be my guess. I have a feeling that the
insets are causing the control to be squeezed to such
a small size. What happens if you remove the insets
and set preferred minimum size equal to the preferred size?
--
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.
Re: Gridbaglayout display issue
Author: Magnus
Date: Fri, 14 Oct 2005 17:34
Date: Fri, 14 Oct 2005 17:34
34 lines
2682 bytes
2682 bytes
Paul Furbacher [TeamB] wrote:
>
> Maybe the size of two dots is considered by the layout
> mechanism to be smaller than any character. Don't know,
> but that would be my guess. I have a feeling that the
> insets are causing the control to be squeezed to such
> a small size. What happens if you remove the insets
> and set preferred minimum size equal to the preferred size?
You are probably right. I'm working on a distance so I don't have easy
access to this problem to test it properly.
However, I did some tests today with an upgrade script and tested that
script on a Win98. I had a look at the box before my upgrade (with
similar problem as the WinXP described earlier) and after and my
adjustments of the constraints fixed it there at least.
--- auto from XY conversion ---
panel1.add(comPortComboBox, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0
, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
new Insets(28, 8, 0, 30), 14, -1));
--- new constraints ---
panel1.add(comPortComboBox, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0
, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
new Insets(28, 1, 0, 1), 0, 0));
Everything else in the panel is kept as it was.
I will continue to do my upgrade from 1.0 to 1.1 tests and at the same
time "play" with my GBL field constraints.
I will keep you posted.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads