Re: automatic refreshing of JTree not working



"Brandon McCombs" <none@xxxxxxxx> wrote in message news:464a7cdf$0$502$4c368faf@xxxxxxxxxxxxxxxxx
Hello,

I'm having a hell of a time trying to get a JTree to automatically refresh to show that a node has been moved from one parent node to another.

I'm using the following statement to move the node to the new parent:
model.getTreeModel().insertNodeInto(movedNode,
newParent,newParent.getChildCount());

I'm trying to implement cut/copy/paste functionality and I'm working to get cut/paste functionality working first so in my paste method I test for the original operation. If it was a "cut" then I do the following:
model.getTreeModel().removeNodeFromParent(movedNode);

However both of the statements above do not make the tree refresh automatically to show the changes. I thought using the above were supposed to do that? I tried the reload() method of the tree model and of course when I do that the entire tree collapses and that isn't what I want (I have a feeling hardly anyone finds that "feature" of the reload() method useful).

Is reloading the tree the only way to make the change in the node's location visible in the tree? If so, what the hell is the point of those particular methods when I could just do, for an insertion, newParent.add(movedNode) instead?


Are you notifying the tree that a new node has been inserted or removed?

--
And loving it,

-Q
_________________________________________________
Qu0llSixFour@xxxxxxxxx
(Replace the "SixFour" with numbers to email me)

.



Relevant Pages

  • Re: automatic refreshing of JTree not working
    ... I'm having a hell of a time trying to get a JTree to automatically refresh to show that a node has been moved from one parent node to another. ... I tried the reload() method of the tree model and of course when I do that the entire tree collapses and that isn't what I want method useful). ...
    (comp.lang.java.gui)
  • Re: automatic refreshing of JTree not working
    ... I'm having a hell of a time trying to get a JTree to automatically refresh to show that a node has been moved from one parent node to another. ... I tried the reload() method of the tree model and of course when I do that the entire tree collapses and that isn't what I want method useful). ...
    (comp.lang.java.gui)
  • automatic refreshing of JTree not working
    ... I'm having a hell of a time trying to get a JTree to automatically refresh to show that a node has been moved from one parent node to another. ... I tried the reloadmethod of the tree model and of course when I do that the entire tree collapses and that isn't what I want method useful). ...
    (comp.lang.java.gui)
  • Re: automatic refreshing of JTree not working
    ... I'm having a hell of a time trying to get a JTree to automatically refresh to show that a node has been moved from one parent node to another. ... I tried the reloadmethod of the tree model and of course when I do that the entire tree collapses and that isn't what I want method useful). ... If so, what the hell is the point of those particular methods when I could just do, for an insertion, newParent.addinstead? ...
    (comp.lang.java.gui)
  • Re: Garbage collection explosion BEFORE my code executes?
    ... I'd suspect alot of that "crazyness" while you're attached is your debugger hitting a breakpoint and halting everything. ... I've tested all the code up until I add in the code for adjusting the tree in the DIV and it all works fine without problems. ... The SECOND time the button is clicked, all hell breaks loose. ...
    (microsoft.public.dotnet.framework.clr)