0

我设置了一个带有 2 个单选按钮的对话框,并使用布尔值以编程方式检查它们。

    // Not working day radio button
    final Button notWorkingDayButton = new Button(mSelectedDayGroup, SWT.RADIO);
    notWorkingDayButton.setSelection(isWorkingDay);
    notWorkingDayButton.setText("Jour chômé"+(isHoliday ? deft : ""));

    // Working day radio button
    final Button workingDayButton = new Button(mSelectedDayGroup, SWT.RADIO);
    workingDayButton.setText("Jour travaillé"+(isHoliday ? "" : deft));
    workingDayButton.setSelection(!isWorkingDay);

正如你所看到的,他们使用相同的boolean,所以他们总是有相反的状态。

下面是它的样子 if isWorkingDayis trueisWorkingDay=真

下面是它的样子 if isWorkingDayis falseisWorkingDay=false

如您所见,第一个收音机保持启用状态。我希望第一个完全禁用,第二个完全启用isWorkingDay = false

4

1 回答 1

2

I don't have a Mac but this looks like the keyboard focus to me. There is no "somewhat enabled" state for radio buttons.

于 2012-05-25T09:05:42.797 回答