This returns the flightNumber no problem, but having called the flightTableModel.getValueAt() method, causes any further searches or reservations which (call the code above) to throw an ArrayIndexOutOfBoundsException. Specifically it is the call to fireTableDataChanged() Which throws the exception. If I take the flightTableModel.getValueAt() call out and replace it with a hard coded flight number, the system works fine ! has anyone got any ideas ?? Cheers, Dean
It is a difficult one. My code is exactly the same as yours and it works fine. I am not sure how getValueAt() is related to fireTableDataChanged(). Even if you have fireTableDataChanged() inside the getValueAt() method, it shouldn't throw any exception. Instead of having a row selection listener, try another JButton to show/book the flights. In that JButton action listener, try to read the selected row. [ May 22, 2002: Message edited by: Sai Prasad ]
Joined: Jan 31, 2002
thanks sai - your suggestion, of reading the flight number from a JButton action works like a dream. i have no idea why reading the value from the ListSelectionEvent casued me problems. ah well. thanks a lot.
No actually the problem is that you have values in the JTable and a row is selected. Say row #5, then you do another search update the table with say 3 rows, this fires the action, and tries to get the flight Number for row #5 but there is only 3 rows. Check this out. Jennifer had the same problem and I fixed it there. Mark