Java updating resultset No registration free public chat adult
You already inherit all of those from the Default Table Model you're extending. The only problem is that the table is not using the model you just created: // JTable table = new JTable(5, 2); JTable table = new JTable(model); Because of the SSCCE I was able to see the exact problem.
In reality you did know how to create a Vector of Vectors, the problem was you didn't know how to add the model to the table.
Rob: if you had look at my last post you'd see i used that very same constructor! So I don't understand the problem with a Vector of Vectors. You may want to consider using set Data Vector since that only triggers one update instead of one for each column, then one for each row.
where i'm stuck is in creating - i guess - the vector of vectors please take another look at my last post (which improves the previous one) And I don't see your SSCCE anywhere. It also removes the need for clearing the rows and column which trigger another 2 updates.
The code is almost identical to what you currently have. The SQL is irrelevant, start by using hard coded data.
When you read the data from the database you load it into the Default Table Model directly. Result Set Meta Data; public class Model Activo extends Default Table Model So how do you respond. The concept you are tying to learn is how to initially load data into the Default Table Model.
A Mysql Data Truncation is throwned when update Row() is executed.
You create a Vector for the columne names and a Vector of Vectors for each row in the Result Set and then you use the Vectors to create the Default Table Model. You do this because if you have problems you can post the SSCCE with the hardcoded data.
For example you could override the is Cell Editable(...) method to allow the first column to be editable but not the second column.
(Although even this can be done by overriding the is Cell Editable() method of JTable, which is what I prefer).
I'm sure you can get that Vector of Vectors that is needed for set Data Vector.
Now you can just remove all instance fields except the Result Set and Result Set Meta Data fields, and all methods except the set Result Set and close methods.
Result Set Meta Data; public class Table Add With Custom Model extends JPanel class Table Model Activo extends Abstract Table Model There is no need to use a custom model period.