I have a JTree with a custom TreeModel and a custom TreeRenderer. The Tree Model contains a bunch of objects of different types. One of these types is displayed differently
A custom editor is required. MyTreeCellEditor
, illustrated here, shows one approach. It updates an arbitrary attribute of a userObject
, which is named Resource
and held in a DefaultMutableTreeNode
. As the attribute is text, it also uses the DefaultTreeCellRenderer
. Your custom TreeModel
probably manages a similar userObject
that is the parent of your "objects of different types."