R
Rene Ruppert
Hi,
I've tried all layout managers so far and no one did what I wanted it to. I
know GridBagLayout will do the job but I cannot figure out how to use it.
I want to have several components width different heights (!) to be aligned
vertically or horizontally.
If I use the following code the components get resized in height (thouh
printing getSize() and getPreferredSize() shows that there height hasn't
changed):
GridBagLayoutgbc.anchor = GridBagConstraints.NORTH;
gbc.gridx = 0;
gbc.gridy = GridBagConstraints.RELATIVE;
gbc.fill = GridBagConstraints.NONE;
parentComponent.add(this, gbc);
If I use the code everything is fine and the components get aligned
horizontally width correct widths and heights:
GridBagLayoutgbc.anchor = GridBagConstraints.WEST;
gbc.gridx = GridBagConstraints.RELATIVE;
gbc.gridy = 0;
gbc.fill = GridBagConstraints.NONE;
parentComponent.add(this, gbc);
Can anybody help please!?
Thanks.
cu
René
I've tried all layout managers so far and no one did what I wanted it to. I
know GridBagLayout will do the job but I cannot figure out how to use it.
I want to have several components width different heights (!) to be aligned
vertically or horizontally.
If I use the following code the components get resized in height (thouh
printing getSize() and getPreferredSize() shows that there height hasn't
changed):
GridBagLayoutgbc.anchor = GridBagConstraints.NORTH;
gbc.gridx = 0;
gbc.gridy = GridBagConstraints.RELATIVE;
gbc.fill = GridBagConstraints.NONE;
parentComponent.add(this, gbc);
If I use the code everything is fine and the components get aligned
horizontally width correct widths and heights:
GridBagLayoutgbc.anchor = GridBagConstraints.WEST;
gbc.gridx = GridBagConstraints.RELATIVE;
gbc.gridy = 0;
gbc.fill = GridBagConstraints.NONE;
parentComponent.add(this, gbc);
Can anybody help please!?
Thanks.
cu
René