gpt4 book ai didi

java - ZK 从组合框中获取选定的项目

转载 作者:行者123 更新时间:2023-11-29 07:21:06 24 4
gpt4 key购买 nike

我试图在组合框中获取选定的值,但它作为 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();

}

最佳答案

我是这样解决的

searchCombo.getSelectedItem().getValue().toString();

关于java - ZK 从组合框中获取选定的项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4385605/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com