Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Adding new rows to table - using TableRowSorter & RowFilter

800467Dec 5 2008 — edited Dec 5 2008
Hi all,

I have a table where the user can add new rows by selecting a JButton. I have added a text box which allows the user to search for a String value and this filters the table contents and this is all working fine...But when I go to add a new row I get the following exception:
java.lang.IndexOutOfBoundsException: Invalid range
which seems to originate from
DefaultRowSorter.rowsInserted
Could someone please give me any ideas to why this is happening, maybe the number of rows that are in the table orginally is set to x and when I add a new row the TableRowSorter is expecting that number not x + 1 which is added due to the button being pressed?

Seems like I need to update the TableRowSorter to inform it that a new row has been added or something similar to that,

Thanks,
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 2 2009
Added on Dec 5 2008
1 comment
72 views