i am unable to show the data from jtable to my textfield in java swing [closed]

int selectIndex = d.getRowCount();

Above is incorrect for two reasons:

  1. An index in Java is zero based. If your table only has 1 row and you try to use 1 as the index you will get an Exception.

  2. The row count does not give you the index” of the row you clicked.

If you want the data in the row you clicked then the code should be:

int selectIndex = jtable1.getSelectedRow();

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top