我试图在组合框中获取选定的值,但它以 ComboItem 的形式返回。如何将值作为字符串获取?
<zscript>
<![CDATA[
String[] months = { "Ada", "Basic", "C", "C++", "Cobol", "Forth",
"Fortran", "Go", "Groovy", "Haskell", "Java", "JavaScript", "Lisp",
"Python", "Ruby", "Scala", "Scheme" };
ListModel lmonths = new SimpleListModel(months);
]]></zscript>
<combobox id="searchCombo"
forward="onChange=onSearch" model="@{months}" >
<!--
<comboitem self="@{each='months'}"
label="@{months}" value="@{months}">
</comboitem>
-->
</combobox>
这里是我的 onSearch 方法
public void onSearch(ForwardEvent event) {
System.out.println(searchCombo.getSelectedItem());
prodevt.search(searchCombo.getSelectedItem().toString());
filterCbox.setChecked(true);
AnnotateDataBinder binder = (AnnotateDataBinder) win.getVariable(
"binder", true);
binder.loadAll();
}