J
Jason Cavett
I am developing an application that displays a JTree and shows
different options based on what the user clicks within the JTree. I
have already populated this JTree. What I'd like to be able to do now
is to display a properties window when I double click on an item in the
JTree.
The objects that I'm placing in the tree are data-type objects (model
objects, I guess). Additionally, there are different views that will
be shown depending on what I have selected in the tree. Unfortunately,
the only way I can figure out how to display the correct view is to do
an "instanceof" to determine what object is selected so I can open the
correct view. This definitely doesn't seem like a good approach.
So, I've tried a few things, but I am kind of stuck on where I should
go. The only other thing I could come up with is to use the
"View"-type objects to populate the tree, then, when the object is
selected, I just do a viewObject.show() so it appears and, of course,
the view object knows about its underlying model.
Whew..I hope that made sense. Can anybody give me any suggestions or
comment on my potential solution?
Thanks
different options based on what the user clicks within the JTree. I
have already populated this JTree. What I'd like to be able to do now
is to display a properties window when I double click on an item in the
JTree.
The objects that I'm placing in the tree are data-type objects (model
objects, I guess). Additionally, there are different views that will
be shown depending on what I have selected in the tree. Unfortunately,
the only way I can figure out how to display the correct view is to do
an "instanceof" to determine what object is selected so I can open the
correct view. This definitely doesn't seem like a good approach.
So, I've tried a few things, but I am kind of stuck on where I should
go. The only other thing I could come up with is to use the
"View"-type objects to populate the tree, then, when the object is
selected, I just do a viewObject.show() so it appears and, of course,
the view object knows about its underlying model.
Whew..I hope that made sense. Can anybody give me any suggestions or
comment on my potential solution?
Thanks