File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes JTable - editing Objects Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply Bookmark "JTable - editing Objects" Watch "JTable - editing Objects" New topic
Author

JTable - editing Objects

zoe goddard
Ranch Hand

Joined: Dec 12, 2000
Posts: 74
I've got a table. It has a column that contains an object. It has a custom renderer that displays the field name of the object. I'd like to be able to edit this name, but whenever I try to hook it up for editing it always tries to edit the object.
Does anyone have any ideas?
Paul Stevens
Ranch Hand

Joined: May 17, 2001
Posts: 2823
If you use DefaultTableModel, you can override the setValueAt method and do what you want.
zoe goddard
Ranch Hand

Joined: Dec 12, 2000
Posts: 74
Thanks, I'll give that a try (I didn't think of that trying that one). Also, while I was looking for answers I discovered I was able to override toString and get rid of my custom renderer.
zoe goddard
Ranch Hand

Joined: Dec 12, 2000
Posts: 74
Worked great! Thanks again.
 
jQuery in Action, 2nd edition
 
subject: JTable - editing Objects
 
Similar Threads
httpServlet and action servlet
Bloch namin' methods funny...
Editable Table in SWT?
why fields are constant in Interfces?
User Defined Global Object accessable by all in container