J
Joris Bleys
Hello everyone,
I've got a little problem getting my GUI as I want.
This is the code I got, but fieldSeperatorLabel isn't at the
rightmost of its cell. It is in the West-side.
JPanel generalPanel = new JPanel();
generalPanel.setLayout(new GridBagLayout());
generalPanel.setBorder(BorderFactory.createTitledBorder(this.general));
GridBagConstraints constraints = new GridBagConstraints();
constraints.ipadx = 4;
constraints.gridx = 0;
constraints.gridy = 0;
generalPanel.add(filenameLabel, constraints);
constraints.gridx = 4;
constraints.gridy = 0;
generalPanel.add(this.browseButton, constraints);
constraints.gridx = 0;
constraints.gridy = 1;
generalPanel.add(recordSeperatorLabel,constraints);
constraints.gridx = 1;
constraints.gridy = 1;
generalPanel.add(this.recordSeperatorField, constraints);
constraints.gridx = 2;
constraints.gridy = 1;
constraints.anchor = GridBagConstraints.EAST;
generalPanel.add(fieldSeperatorLabel, constraints);
constraints.gridx = 3;
constraints.gridy = 1;
constraints.anchor = GridBagConstraints.CENTER;
generalPanel.add(this.fieldSeperatorField, constraints);
constraints.gridx = 1;
constraints.gridy = 0;
constraints.gridwidth = 3;
generalPanel.add(this.filenameField, constraints);
Any ideas where I'm getting it wrong ?
Thx in advance,
Joris
I've got a little problem getting my GUI as I want.
This is the code I got, but fieldSeperatorLabel isn't at the
rightmost of its cell. It is in the West-side.
JPanel generalPanel = new JPanel();
generalPanel.setLayout(new GridBagLayout());
generalPanel.setBorder(BorderFactory.createTitledBorder(this.general));
GridBagConstraints constraints = new GridBagConstraints();
constraints.ipadx = 4;
constraints.gridx = 0;
constraints.gridy = 0;
generalPanel.add(filenameLabel, constraints);
constraints.gridx = 4;
constraints.gridy = 0;
generalPanel.add(this.browseButton, constraints);
constraints.gridx = 0;
constraints.gridy = 1;
generalPanel.add(recordSeperatorLabel,constraints);
constraints.gridx = 1;
constraints.gridy = 1;
generalPanel.add(this.recordSeperatorField, constraints);
constraints.gridx = 2;
constraints.gridy = 1;
constraints.anchor = GridBagConstraints.EAST;
generalPanel.add(fieldSeperatorLabel, constraints);
constraints.gridx = 3;
constraints.gridy = 1;
constraints.anchor = GridBagConstraints.CENTER;
generalPanel.add(this.fieldSeperatorField, constraints);
constraints.gridx = 1;
constraints.gridy = 0;
constraints.gridwidth = 3;
generalPanel.add(this.filenameField, constraints);
Any ideas where I'm getting it wrong ?
Thx in advance,
Joris