有人可以请解释两个单选按钮之间的差距的原因吗? 我甚至将水平空间设置为0,但没有任何改变。使用GridLayout的两个按钮之间的额外空格
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);
}
}
也许“固定大小”字符串包含空格右边?你可以试着用'trim()'去除它们。 –
我不这么认为。所有的字符串都从json文件中提取出来,并且它们具有相同的大小。 – Ben193
为什么有3个'new Label(container,SWT.NONE);'在顶部?它们只是用作分隔符吗?但他们应该是4而不是3,对吗?也许第一个有不同的尺寸... –