This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
I have searched this site for how to add and remove ROWS from a JTable using a AbstractTableModel, but every response replies with "Use DefaultTableModel". I have also searched On google for an example or some sort, but have come up empty handed. Does anyone know how to do this? What I want is to basically add an Empty Row that I can type the data directly into the JTable. I do not want to prompt the user for the data first. here is my code so far
Ok, I have solved my own problem, but now I have a new problem. When I insert initial data when the Table is created, all the data in each cell is surrouned by [ ]. But if I edit the data, then those are gone. Does anyone know why this is happening?
Ok, once again, I have answered my own question. I just don't have a solution for it yet short of parsing through each string and removing the . But, because it is a Vector within a Vector is why there are the . I would like to know if there is an easy way to get rid of those brackets though.
hi Gregg, You don't need to use a 2dim Vector if you are implementing you own table model. In your case (as I understand it) you have a one column table. So a list of strings is all you need to store the data in your model:
If you change your mind and you want to add other columns than you might choose to make a class that describes one column. Say "Person" that has as Attributes "Age", "Nickname", etc. Your table model can then take a list of Person objects and map them to the table. cheers