aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes  question about jcheckbox Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark " question about jcheckbox" Watch " question about jcheckbox" New topic
Author

question about jcheckbox

Kevin Pang
Ranch Hand

Joined: Mar 01, 2005
Posts: 38
how to achieve the "check all" function and get the value from all jcheckbox checked ? how to do the function in swing as in javascript getElementById() ?
thanks.
Kevin Pang
Ranch Hand

Joined: Mar 01, 2005
Posts: 38
solved
Container c = jck.getParent();
Component[] comps = c.getComponents();
for (Component comp : comps) {
if (comp instanceof JCheckBox) {
if (((JCheckBox) comp).isSelected()) {
rsltInfor.append(((JCheckBox) comp).getText() + " ");
}
}

}
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: question about jcheckbox