• Post Reply Bookmark Topic Watch Topic
  • New Topic

delete data from table

 
helmie alwi
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


can you guys tell me how to delete data from this jtable with using a selected.
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Typically you will need to add/remove the data from the model and ensure the appropriate fireXXXChange event to ensure the view (table) is updated.

In your case, you read the file, extract the tokenized data and store it in

Since it is a list, it is very easy to remove the required element(s) from the list. Once done, if you trigger fireTableDataChanged() your view (table) should be automatically refreshed.

Find more details and code snippets here https://docs.oracle.com/javase/tutorial/uiswing/components/table.html

PS. In future, while posting code, please UseCodeTags. I have added them this time for you. As you can see the tags make the code much more easier to read and understand.
 
Rob Camick
Ranch Hand
Posts: 2699
10
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Data needs to be removed from the TableModel, not the table.

 
helmie alwi
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks you sorry for my mistake T_T heehheee
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!