Re: GridBagLayout not behaving as specified
- From: "Qu0ll" <Qu0llSixFour@xxxxxxxxx>
- Date: Thu, 19 Apr 2007 01:18:16 +1000
"Ian Wilson" <scobloke2@xxxxxxxxxxxxx> wrote in message news:46262fa9$0$6950$fa0fcedb@xxxxxxxxxxxxxxxxx
[snip]
After
panel.add(dbButton, gbc);
I added
gbc.gridx = 1;
gbc.gridy = 2;
gbc.gridwidth = 1;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.anchor = GridBagConstraints.EAST;
gbc.weightx = 0.0;
gbc.weighty = 0.0;
gbc.insets = new Insets(0, 4, 18, 8);
gbc.ipadx = 0;
for (int x=0; x < 16; x++) {
gbc.gridx=x;
panel.add(new JLabel(Integer.toString(x)), gbc);
}
The results are interesting.
I think you could use fewer than 16 columns and this might make things more predictable. I suspect some columns are shrinking to zero width because no component STARTS in them.
I have indeed tried fewer columns and the results are identical. I have tried as few as 6 columns which is the minimum required to get the results I desire. It just doesn't seem to work as it should.
Personally I'd use MigLayout and have about 1/10th the code.
I have never used it but I really need to understand why this code is failing. Any other ideas?
--
And loving it,
-Q
_________________________________________________
Qu0llSixFour@xxxxxxxxx
(Replace the "SixFour" with numbers to email me)
.
- Follow-Ups:
- Re: GridBagLayout not behaving as specified
- From: Ian Wilson
- Re: GridBagLayout not behaving as specified
- From: Ian Wilson
- Re: GridBagLayout not behaving as specified
- References:
- GridBagLayout not behaving as specified
- From: Qu0ll
- Re: GridBagLayout not behaving as specified
- From: Ian Wilson
- GridBagLayout not behaving as specified
- Prev by Date: Re: javax.swing.JPopupMenu cannot be cast to javax.swing.JMenuItem
- Next by Date: Re: javax.swing.JPopupMenu cannot be cast to javax.swing.JMenuItem
- Previous by thread: Re: GridBagLayout not behaving as specified
- Next by thread: Re: GridBagLayout not behaving as specified
- Index(es):