• 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

How to select multiple values using JCheckbox

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello all,

Can any buddy tell me, how to select multiple values using JCeckbox??? so that when i press submit button it should display all selected values.



 
Ranch Hand
Posts: 129
Netbeans IDE Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I do not understand what you want. Can you please elaborate?

As far as I got you can have as many jcheckboxes as you want and get all of them submitted on clicking submit.
 
Narendra kodli
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

here i am attaching my code please go through it, here when i select multiple values and press submit button and i am getting only single value, so please help me to solve.


 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Narendra kodli wrote:
here i am attaching my code please


Your code? You're Anil Kumar? Strange of you to be asking questions 12½ years after you wrote it.
http://www.codeguru.com/java/articles/567.shtml
 
Narendra kodli
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Darryl Burke
Strange of you to be asking questions 12½ years after you wrote it.



Off course it has been originally written by AnilKumar. But so what? i want my doubt got cleared? doesn't matter who have written the code.
If you know the solution then please tell me.
 
Rancher
Posts: 3324
32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you are getting a single selection then you have only have one line selected in the JList.

If you want to get the number of check boxes that you have selected then you need to loop through the ListModel to check the value of each entry.

Checkbox selection has nothing to do with the selection model used by the JList.
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Narendra kodli wrote:Off course it has been originally written by AnilKumar. But so what? i want my doubt got cleared? doesn't matter who have written the code.


It does if you claim it's yours while you haven't written it. In this case it's probably a misunderstanding caused by the "my" part, but if you'd do it in a more serious manner you could get sued. You definitely would not want that.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic