ListModelListを使用して選択肢のリストをZKリストボックスに追加しました。次に、これらの選択肢のリストをループして、必要な項目(「文字列」など)を見つけようとしました。このアイテム(「文字列」)を選択したアイテムとして設定する必要があります。
以下のコードを試しましたが、機能しません。これを行う方法はありますか?
liveListModel = new ListModelList(new AppModelItem [] {
new AppModelItem("String", "string"),
new AppModelItem("Number", "number"),
new AppModelItem("Array", "array")
});
String choice [] = {"String", "Hello", "XYZ" };
Listbox typesList = new Listbox();
typesList.setModel(liveListModel);
for (int i = 0; i < choice.length; i ++) {
if (choice.[i] == typesList.getItemAtIndex(i).getValue().toString());
typesList.setSelectedItem(typesList.getItemAtIndex(i));
}
ありがとう、ソニー