Could someone please explain me the reason of the gap between the two radio buttons ? I even set the horizontal space to 0 but nothing has changed.
case composed:
new Label(container, SWT.NONE);
new Label(container, SWT.NONE);
new Label(container, SWT.NONE);
container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
container.setLayout(new GridLayout(4, false));
for (int j = 0; j < this.itr; j++) {
Button[] radioButton = new Button[answers.size()];
for (int i = 0; i < answers.size(); i++) {
String ans = answers.get(i).getValue();
radioButton[i] = new Button(container, SWT.RADIO);
radioButton[i].setText(ans);
}
Text[] textField = new Text[answers.size()];
for (int i = 0; i < answers.size(); i++) {
textField[i] = new Text(container, SWT.SINGLE | SWT.BORDER);
for (int i = 0; i < answers.size(); i++) {
textField[i] = new Text(container, SWT.SINGLE | SWT.BORDER);
}
}
Probably the Label
with the text "Please enter the key size of your algorithm"
is on the first column of the GridLayout
, therefore all the rows are affected by its size.
You should divide the two sections, for example using different Composites
with different layouts, one for the first Label
and another for the content with the buttons.
For example:
container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
container.setLayout(new GridLayout(1, false));
Composite questionContainer = new Composite(container, SWT.NONE);
questionContainer.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
questionContainer.setLayout(new FillLayout());
Label question = new Label(questionContainer, SWT.NONE);
question.setText("Please enter the key size of your algorithm");
Composite contentContainer = new Composite(container, SWT.NONE);
contentContainer.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
contentContainer.setLayout(new GridLayout(4, false));
// rest of the content using contentContainer as parent