Thursday, June 27, 2013

009. ADD ROW / REMOVE ROW (JTABLE PART 2)

 Requirements (we have read):
- 008. Add Database to JTable (JTable Part 1).

In this case, we are talking about my way.
We need to change script to be:
dtble.buildTable(tbl, true, sqlFrom, dCon, false);

And, the first column should be editable. For example:
dtble.addColumn("'' STATUS","status", true, "java.lang.String", "text", 70, "");

Then:
- to add row: type -dn- in first column
- to remove row: type -xx- in first column.

Perhaps:
- tbl.setValueAt("-dn-", rowIndex, 0);
- tbl.setValueAt("-xx-", rowIndex, 0);

Note:
This action doesn't affect the database. We need another action to do that. May be, someday I will write it.