This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft 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 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Remove Row in jtable" Watch "Remove Row in jtable" New topic
Author

Remove Row in jtable

sajjad Hhh
Greenhorn

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!
Thanks!
Kemal Sokolovic
Bartender

Joined: Jun 19, 2010
Posts: 825
    
    5

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: http://aspose.com/file-tools
 
subject: Remove Row in jtable
 
Similar Threads
Reading file to JTable
Timer not happening in this example
reading CSV file
JTable isCellEditable not working
JTextfield data in JTable row