• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

IndexOutOfBounds using JTable which uses List abstractTableModel ListSelectionModel

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
=====================================



 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Marshal
Posts: 79179
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks guys.

I managed to fix it, here is the altered code


 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic