• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

JTable blues

 
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 820
IntelliJ IDE VI Editor Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
reply
    Bookmark Topic Watch Topic
  • New Topic