I am trying to implement functionality something similar to yahoo mail. I have a JTable having 5 columns. now i want to add one more column which has checkbox for each row. Then when the user selects multiple checkboxs and clicks on add, i want to select corresponding rows from the table and add in the db.
Till now i am able to add a column to the table, showing checkbox in each row.
now my problem is i am not able to select multiple checkboxes at a time.when i select the second one, firstone is getting deselected. can anyone please tell me what should i do to select multiple checkboxes (select multiple rows). I tried for examples in net..but no help. can anyone please give me a sample example, if they have...
SO AS OF NOW I AM ABLE TO SHOW THE CHECKBOX ON THE JTABLE FIRST COLUMN. NOW I WANT TO ADD FUNTIONALITY SO THAT WHEN I SELECT CHECKBOXES(MULITPLE), I WANT TO SELECT THE CORRESPONDING ROWS. BUT NOW WHEN I CLICK ON CHECKBOX, IT IS GETTING SELECTED, BUT WHEN I CILCK ON SECOND THE FIRST CHECKED CHECKBOX IS AGAIN GETTING DESELETED.
I'm not sure what's wrong with your code. But there is an easier way for a checkbox in JTable. If you have the datatype of that column as Boolean, it will be very straightforward. Java tutorial has a simple example on this, TableDemo.java. Hope this helps.