Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Jtable refresh

 
hassan ali
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have table list name and ID

i choose row then name it apper in textfield i give this name password in another textfield

then click Jbutton save

i need this name and its row to be removed from jTable


note my JTable use TableModel extends from DefaultTableModel and in JScrollPane

this TableModel has implemented function called go() to reload data[][]

so
i call go() function ,then fireTableDataChanged()

but no effect
why?
 
hassan ali
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it looks need some steps and organizing

1-new object from your tableModel that extends DefaultTableModel
Tablemodel new_model=new Tablemodel();

2-use command setModel in your JTable Object to set new Model that you create last step

table.setModel(new_model);


3- run function that you create it that re_fil your data array (data[][]) in side your new Model to get the new data

new_model.go_get_Date();

4-Fire data change function to take new data and put it inside your table

((DefaultTableModel)table.getModel()).fireTableDataChanged();



these steps for refresh all the table i hope it understandable
 
Rob Spoor
Sheriff
Pie
Posts: 20606
60
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why don't you just use DefaultTableModel and use its methods for removal?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic