aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes How to select multiple values using 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 "How to select multiple values using JCheckbox" Watch "How to select multiple values using JCheckbox" New topic
Author

How to select multiple values using JCheckbox

Narendra kodli
Greenhorn

Joined: Dec 24, 2011
Posts: 22
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.



Nitin Surana
Ranch Hand

Joined: Jan 21, 2011
Posts: 129

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

Joined: Dec 24, 2011
Posts: 22

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.


Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4540
    
    5

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


luck, db
There are no new questions, but there may be new answers.
Narendra kodli
Greenhorn

Joined: Dec 24, 2011
Posts: 22
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.
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2182
    
    7
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.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19692
    
  20

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.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to select multiple values using JCheckbox