简体   繁体   English

如何检查J2ME中的复选框是选中还是未选中?

[英]How to check whether a checkbox is checked or unchecked in J2ME?

如何检查J2ME中的复选框是选中还是未选中?

 boolean flags[] = new boolean[choiceBox.size()];
 choiceBox.getSelectedFlags(flags);  

Queries the state of a ChoiceGroup and returns the state of all elements in the boolean array selectedArray_return. 查询ChoiceGroup的状态,并返回布尔数组selectedArray_return中所有元素的状态。 NOTE: this is a result parameter. 注意:这是一个结果参数。 It must be at least as long as the size of the ChoiceGroup as returned by size(). 它必须至少与size()返回的ChoiceGroup的大小一样长。 If the array is longer, the extra elements are set to false. 如果数组较长,则多余的元素将设置为false。

For ChoiceGroup objects of type MULTIPLE, any number of elements may be selected and set to true in the result array. 对于MULTIPLE类型的ChoiceGroup对象,可以选择任意数量的元素并将其在结果数组中设置为true。 For ChoiceGroup objects of type EXCLUSIVE, exactly one element will be selected, unless there are zero elements in the ChoiceGroup. 对于EXCLUSIVE类型的ChoiceGroup对象,除非ChoiceGroup中有零个元素,否则将只选择一个元素。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM