This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Remove Row in jtable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Remove Row in jtable" Watch "Remove Row in jtable" New topic

Remove Row in jtable

sajjad Hhh

Joined: Dec 24, 2012
Posts: 3
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!
Kemal Sokolovic

Joined: Jun 19, 2010
Posts: 825

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.

The quieter you are, the more you are able to hear.
I agree. Here's the link:
subject: Remove Row in jtable
It's not a secret anymore!