• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Remove Row in jtable

 
sajjad Hhh
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi every one.
i have a jtable that correctly read data frome file and show them in own.
I want to add a "Delete" button that when select a row and clicked button, row must deleted.
But, when i click the button, row dont deleted and a ArrayOutOutBoundsException occur.

my whole code is this:



please repair my code!
Thanks!
 
Kemal Sokolovic
Bartender
Posts: 825
5
Java Python Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm gonna have to disappoint you and tell you that nobody is going to repair code for you, since this forum is NotACodeMill. However, here are some hints for you:

You should remove data from table model, since model is the one holding the data; JTable is there just to show it. You are extending AbstractTableModel, but from what I see you could as well use DefaultTableModel which already provides method(s) you need. Also, it's advised not to use Vector class, so take a look at that too.
As a side note, JTable#remove(int index) is not doing what you think it is so I would suggest you check the API for more information.
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic