aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Treetable events Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Treetable events" Watch "Treetable events" New topic
Author

Treetable events

Catherine Dunn
Greenhorn

Joined: Feb 10, 2006
Posts: 4
Hello,

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:

http://java.sun.com/products/jfc/tsc/articles/treetable1/

I also found this post on JavaRanch

http://www.coderanch.com/t/333349/GUI/java/JTreeTable

It was very helpful in terms of constructing the treetable model, but it didn't address event handling. A push in the right direction would be much appreciated.

Thanks,
Catherine
Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
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.
Catherine Dunn
Greenhorn

Joined: Feb 10, 2006
Posts: 4
Thank you, thank you, thank you!

This problem has been driving me crazy!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Treetable events
 
Similar Threads
Need Info on JTreeTable
Need some help creating a JTreeTable
JTreeTable
JTable In JTree
JTreeTable ToolTip problem