aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes IndexOutOfBounds using JTable which uses List abstractTableModel ListSelectionModel Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "IndexOutOfBounds using JTable which uses List abstractTableModel ListSelectionModel" Watch "IndexOutOfBounds using JTable which uses List abstractTableModel ListSelectionModel" New topic
Author

IndexOutOfBounds using JTable which uses List abstractTableModel ListSelectionModel

Shell Durham
Greenhorn

Joined: May 27, 2014
Posts: 2
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
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8



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

Joined: Oct 13, 2005
Posts: 38897
    
  23
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

Joined: May 27, 2014
Posts: 2
Thanks guys.

I managed to fix it, here is the altered code


 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: IndexOutOfBounds using JTable which uses List abstractTableModel ListSelectionModel