• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

IndexOutOfBounds using JTable which uses List abstractTableModel ListSelectionModel

 
Shell Durham
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please can anyone help with this problem, I keep getting IndexOutOfBounds exceptions in several circumstances, eg:
* add student & then click on the last student displayed in the table
* delete student & then click on the student after the one that was deleted in the table
* delete the last record in the table
* probably more

Part of the stack trace:
==============


NetBeans 8.1 Code: https://www.dropbox.com/sh/rck6j5301avco4s/AACBqAkFYwvgc3HkeDfZZmt_a

Only Student & Lecturer coding is finished so far & found IndexOutOfBound problems when testing.
* Hierarcy for Student Code
view.MvcApp (main app)
view.MainFrame (JFrame with menu bar)
view.StudentView (JPanel,JTable,etc used in JFrame)
controller.StudentController
dao.StudentDAO
util.dbUtility (accesses c:/myjava/A2/SIT751db.accdb)
model.Student

view.StudentView extracts
=========================


controller.StudentController extracts
=====================================



controller.StudentTableModel extracts
=====================================



 
Paul Clapham
Sheriff
Posts: 21117
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


I haven't studied your code in detail, but taking this code at face value, you get a row index from one object and then look for that row in a different object.
 
Campbell Ritchie
Sheriff
Pie
Posts: 49380
62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch
I had to put some end of line characters in your stack trace because the long lines are very difficult to read.
 
Shell Durham
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks guys.

I managed to fix it, here is the altered code


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic