• Post Reply Bookmark Topic Watch Topic
  • New Topic

Delete the entire row within the JTable..

 
fiddy chan
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i m using JTable to display my data.. now i've to click onto the row and then there a delete button. once i selected the row and clicked the button. the entire row will been delete from the JTable.. as well as my txtfile.. pls give me advice to make this work.. thanks
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by fiddy chan:
i m using JTable to display my data.. now i've to click onto the row and then there a delete button. once i selected the row and clicked the button. the entire row will been delete from the JTable.. as well as my txtfile.. pls give me advice to make this work.. thanks

Hmmm, first I would write the code to delete the row from the JTable and on this event, you write the IO to remove that line from your text file.
Oh, maybe you knew this already. What have you tried? Are you getting errors with your current code or do you expect us to write it for you??
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This will get you started on detecting changes to a JTable and it's TableModel. That link talks about when a row is added, but when a row is deleted, it's basically the same thing.
Removing the entry from your textfile has nothing to do with Swing, so when you get the row deletion working in your JTable, you can ask more about the IO part of your problem in the IO and Streams forum.
When you have some code going and are having problems with it, post what you have and we will be happy to assist you in getting it right.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!