Validate input with JTable
Posted on 2003-11-23
I would like to see an example on how to implement code (with Java version 1.3.1 ) to validate inputs with Table (instance of defaultTableModel) and store afterward. My JTable consists of the following columns - TextField, integer, ComboBox. I can edit table cells. I have two separated dialogs - (1) to add data to an empty JTable (2) to edit existing data in the JTable and to add new row(s).
When working with the 1st and 2nd dialogs, adding new table entry-I want to validate my cells - ensure the text field can not excess 200 characters, integer(between 1 to 100), and comboBox(true, false).
When working with 2nd dialog, I want to be able to detect changes to cells. All columns require to sort.
I will be fetching data from database. Is defaultTableModel right approch?