Hi there, I've got a JTable in which ppl can change some data. Before selecting anything else on the screen I want the data that is changed checked (ppl can change data in the same row without a problem, without checking..). So I added a List Selection Listener to the ListSelectionModel and it works like a charm.. almost.. If a user selects a row, edits some fields in it and selects another row I can check the data. But the ListSelectionModel doens't react on keyboard navigation input (arrow up, arrow down).. Is there anyway to override the standard keyboard navigation ? I have another question.. When is the setValueAt from the tablemodel called? I noticed that when defocusing the table after changing a textfield in it (without pressing enter, changing cells,...) the setValueAt method is not called... anyway to get around this without too much hastle? Thanks! Sebastiaan
Sebastian, I think you are looking for a DefaultCellEditor Have you looked at this discussion of abstractTableModel ? They have code there for an IntegerEditor that extends DefaultCellEditor and can validate that the user has entered a proper integer. I have just been playing with it and it gives ways to do what you want to do.
Joined: Mar 12, 2004
Hi there, I already took a look at that section, but it doesn't cover my problem. I'm working in a client-server environment, and I would like to keep the data checking server-side... Also, some values for a cell are only valid if another cell has a certain value.. To get this done, I only send data to the server for checking if another row is selected, so all values can be checked for consistency. Is there another way around this? Thanks!