Tag: radio group

在SWT中设置/获取RadioGroupFieldEditor的值

我正在尝试在我正在开发的Eclipse RCP应用程序中添加一个RadioGroupFieldEditor,但似乎无法做两件关键事情: 设置单选按钮的值(即打开对话框/窗口时,我想将默认值设置为“button1”) 获取所选单选按钮的当前值(即,用户已选择的内容,或者如果未设置任何内容,则为上面设置的默认值)。 我正在使用的代码如下: String[][] radioButtonOptions = new String[][] { { “Button1” “button1” }, { “Button2” “button2” } }; RadioGroupFieldEditor radioButtonGroup = new RadioGroupFieldEditor(“PrefValue”, “Choose Button1 or Button2”, 2, radioButtonOptions, parent, true) 我有一个fireValueChanged()方法,我可以用它来设置另一个带有值的String变量(当用户做出选择时),但这看起来很麻烦。 它也不允许我设置默认值… 我怀疑我遗漏了一些重要的东西! 上面应该有get / set方法吗?