editing nodes in JTree, icon problem  
Author Message
Ender





PostPosted: 2008-2-24 3:38:00 Top

java-programmer, editing nodes in JTree, icon problem I have a JTree with a child node that has a dropdown list in it. When I
click on the node to make the list appear, then make a selection, the
icon changes to what looks like a document icon.

My problem is that the document icon stays there after I make the
selection in the dropdown list until I click on another node. It's like
the process of making a selection is unfinished.

Anyone know what that is?

 
John





PostPosted: 2008-2-27 0:44:00 Top

java-programmer >> editing nodes in JTree, icon problem Ender a 閏rit :
> I have a JTree with a child node that has a dropdown list in it. When I
> click on the node to make the list appear, then make a selection, the
> icon changes to what looks like a document icon.
>
> My problem is that the document icon stays there after I make the
> selection in the dropdown list until I click on another node. It's like
> the process of making a selection is unfinished.
>
> Anyone know what that is?

The combo box is still in editing state when you select a value. You could add an action listener to the combo box (problem for reselecting the same value) and stop the editing when you receive an action event.

 
Ender





PostPosted: 2008-3-7 0:41:00 Top

java-programmer >> editing nodes in JTree, icon problem On 2008-02-26 10:44:09 -0600, John <email***@***.com> said:

> Ender a 閏rit :
>> I have a JTree with a child node that has a dropdown list in it. When I
>> click on the node to make the list appear, then make a selection, the
>> icon changes to what looks like a document icon.
>>
>> My problem is that the document icon stays there after I make the
>> selection in the dropdown list until I click on another node. It's like
>> the process of making a selection is unfinished.
>>
>> Anyone know what that is?
>
> The combo box is still in editing state when you select a value. You
> could add an action listener to the combo box (problem for reselecting
> the same value) and stop the editing when you receive an action event.

That's what I actually have. I have an ActionListener tied to this
JComboBox in the JTree node and in the ActionListener, I have a
stopCellEditing() call, but before and after that call I put an
isEditing() to see if it was in editing state and it returns false.

But if I click on another node after making the selection, then the
icon returns to it's normal icon; otherwise, the icon is the editing
doc icon after I make a selection and before I click on anything else.