aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes JTable blues Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTable blues" Watch "JTable blues" New topic
Author

JTable blues

Sebastiaan Kortleven
Ranch Hand

Joined: Mar 12, 2004
Posts: 81
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
Tim McGuire
Ranch Hand

Joined: Apr 30, 2003
Posts: 820

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.
Sebastiaan Kortleven
Ranch Hand

Joined: Mar 12, 2004
Posts: 81
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!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JTable blues
 
Similar Threads
JTable
JTable(!!!)
JTable
JTable cell alignment
JTable Paging