⑴ java方法如何判断多选框是够勾选
js">javascript:
functiontest(){
varcb=document.getElementById('checkboxid');
if(cb.checked){
//TODOnormalwork...
}else{
alert('pleasecheckit');
return;
}
}
⑵ java中如何判断是哪个单选框被选中了
上述使用有问题:
正确使用方法为:
CheckboxGroup cbg = new CheckboxGroup();
add(new Checkbox("one", cbg, true));
add(new Checkbox("two", cbg, false));
add(new Checkbox("three", cbg, false));
然后,像qsmy所述,使用:回
CheckboxGroup的方法:
Checkbox getSelectedCheckbox()
Gets the current choice from this check box group. 得到选择的Checkbox。答
⑶ java中怎样判断复选框是否被选中
复选框 JCheckBox
中有个isSelected() 可以 判断是否被选中
选中为true
反之则为false
⑷ java中怎么知道单选框的选中状态
使用JRadioButton定义选择按钮,如果要实现单选,需要把按钮添加至ButtonGroup,如下:
ButtonGroup buttonGroup2 = new ButtonGroup();
JRadioButton select_ID = new JRadioButton();
JRadioButton select_Name = new JRadioButton();
JRadioButton select_Book = new JRadioButton();
JRadioButton select_All = new JRadioButton();
初始化时执行:回
buttonGroup2.add(select_ID);
答buttonGroup2.add(select_Book);
buttonGroup2.add(select_Name);
buttonGroup2.add(select_All);
判断是否选中:
select_Name.isSelected() 选中时返回true,否则false