This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Howdy folks! I'm trying to implement a JTable that automatically adds and deletes rows as the user types. The last row will always be blank (except for data in the 1st column), so when a user types something in any column of the last row, I'd like it to add a new blank row to the bottom of the table. In addition, I'd like rows that become empty from a user pressing backspace or delete to automatically disappear. What I've written so far almost works, but ocassionally when a new row gets added, the characters that the user typed disappear. Deletion doesn't work predictably either. Here's the class:
Thanks for the help Chantal. Finally got it working reasonably. The problem was that I didn't set an appropriate default cell editor. Also, FYI, when the cell editor cancels editing, the data still disappears. In my case, the cell loses focus when a new row is added (which is after the first character gets typed in the nth cell). Does anyone know offhand how to do a fireTableRowsInserted(x,y) without changing the currently selected and editing cell? Here's what the code looks like now:
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com