Hello guys.
I am doing a swing application wherein I m using a DefaultTableModel.
Here's my code:

DefaultTableModel tab = new  DefaultTableModel(){
         @Override  public boolean isCellEditable(int r, int c){
                        //if(c == 10) {return true;}
                        return false;
     private JTable jt = new JTable(tab);

The JTable will diplay records from database.
I have a form where I am displaying the tabl. I have a 'Delete' button on whose click I want to delete the row selected of the Jtable.
The reason I m using a DefaultTableModel is becoz I want to dynamically add rows to the JTabl depending upon the no. of records in my database table.
So, I cannot find a function using which I can get the row selected..or atleast the cell selected.
How can I do that? Thanks.

7 Years
Discussion Span
Last Post by abhi_elementx

The selection happens in the JTable, not in the underlying model, so you need to look at JTable methods like getSelectedRow() etc.

This question has already been answered. Start a new discussion instead.
Be sure to adhere to our posting rules.