wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes JTable doesn't show new model after adding new row Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTable doesn Watch "JTable doesn New topic
Author

JTable doesn't show new model after adding new row

Davide Aguiari
Greenhorn

Joined: Aug 28, 2012
Posts: 5

I can't repaint my jTable. I must re-run all application to show addRow.

This is the code:

MainPage.java http://pastebin.com/6FZL1pKC



These last 3 println() show that model has changed! lol{} Output:

Tratta AGGIUNTA

javax.swing.table.DefaultTableModel@1ca7e4a

BOLOGNA

...

CATANZARO

NEW_DEPARTURE_ADDED

javax.swing.table.DefaultTableModel@17d54dd

javax.swing.table.DefaultTableModel@17d54dd

So it works..but It doesn't show new model!!

AddTrip.java http://pastebin.com/t0LqF91a



MPTable.java http://pastebin.com/2gXvYNLC



I've tried to add tripModel.fireTableDataChanged() after MPTable.myModel() or jTable1.setModel or .repaint() [all in tripRepaint()] with no success.
 
Consider Paul's rocket mass heater.
 
subject: JTable doesn't show new model after adding new row
 
Similar Threads
JTable Updating
Unknown number of rows to create a JTable
JTable & AbstractTableModel(Delete row problem)
How to add rows to jTable dynamically?
jtable