• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

question about jcheckbox

 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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() + " ");
}
}

}
 
reply
    Bookmark Topic Watch Topic
  • New Topic