Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jtable not updating properly...

John Low
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello all,
i'm having some trouble updating my JTables properly. i have 3 JTabbedPanes, two of which have JFrames which contain JTables, each of which uses a subclass of AbstractTableModel to represent the data models.
the gui subscribes to a jms topic and, upon consumption of a message, processes and propagates the changes required by the content of the message. on the first message after client startup, it behaves as it should, but subsequently fails--e.g. if i insert a row into one of the tables, the data is displayed, however, the table.getSelectedRow() _always_ returns -1.
here is some of the update code:

first i extract the message payload and then based on that information the clients whose users are a member of the list of assignees will have their guis updated. for each notifiee of this message i generate a new tableModel since the existing model is no longer valid (i.e. messages only arrive upon modification of the server's data model by a client). then, based on the new tableModel that i have, i invoke generateTable(TableModel) to generate JTable based on the tableModel passed. i then set the JTable belonging to each subclass of JFrame in each JTabbedPane to the generated JTable.
a version of this code did work at some point before, but i've lost it and can't recall how i did it...
any help is greatly appreciated!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic