aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Jtable refresh Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Jtable refresh" Watch "Jtable refresh" New topic
Author

Jtable refresh

hassan ali
Ranch Hand

Joined: Apr 23, 2006
Posts: 127
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

Joined: Apr 23, 2006
Posts: 127
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

Joined: Oct 27, 2005
Posts: 19697
    
  20

Why don't you just use DefaultTableModel and use its methods for removal?


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Jtable refresh