This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I am trying to create a treetable that displays numerical data. I want the user to be able to edit the data in the treetable by clicking on a cell and entering a new value. I figured out how to create the treetable and treetable model, but I can't figure out how to do the event handling. I read somewhere that I need to extend DefaultCellEditor, but I haven't been able to figure out how to do that.
I have studied the three-part Sun treetable tutorial:
The bookmarks example (bookmarks.zip) in the third article runs okay and allows user–editing of the URLs in the "Location" column. I compiled it in j2se 1.5 with these changes: 1 — changed the deprecated show method to setVisible at the end of the TreeTableExample3 constructor 2 — in the getValueAt method of the DynamicTreeTableModel class: j2se 1.5+ has the "varargs" feature so change the "null" values to zero–length arrays in the reflection methods:
This second change should not be necessary in older versions.