Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #3969

Re: JTree - subnode not a

From "Daniele Futtorovic" <daniele.futtorovic@THRWHITE.remove-dii-this>
Subject Re: JTree - subnode not a
Message-ID <g7to9c$m5q$1@registered.motzarella.org> (permalink)
Newsgroups comp.lang.java.gui
References <c041d8e8-cab7-4e4b-a247-4eb165e62237@m3g2000hsc.googlegroups.com>
Date 2011-04-27 15:47 +0000
Organization TDS.net

Show all headers | View raw


  To: comp.lang.java.gui
On 13/08/2008 05:43, pelakh@yahoo.com allegedly wrote:
> I have a simple JTree in one of my panels, using the DefaultTreeModel
> populated with
> my own FileTreeNode objects, which extend DefaultMutableTreeNodes. I
> am adding
> nodes into the tree by doing parentNode.add(subNode), which seems to
> work just
> fine in most cases. However, in a particular case, my new nodes don't
> show up, even
> though I can find them both in the children of the parent and through
> the tree model.
> Right after the add, I call repaint to update the tree, and then trace
> some debug information
> I get the following:
> 
> *** This is the first insertion - it works fine ***
> Row for freq [TreeRoot, Smooth Files, AC #377, 20.250] is 21
> Row for new path [TreeRoot, Smooth Files, AC #377, 20.250, Baseline 1]
> is 22 bounds are java.awt.Rectangle[x=80,y=420,width=82,height=20]
> 
> *** This is the same trace for any consequent insertion - does not
> work***
> Row for freq [TreeRoot, Smooth Files, AC #377, 20.250] is 21
> Row for new path [TreeRoot, Smooth Files, AC #377, 20.250, Baseline 2]
> is -1 bounds are null
> 
> It is as if the TreeUI completely loses this node. Furthermore, the
> vertical line preceding the
> label of 'Baseline 1' disappears after 'Baseline 2' is added, but that
> is the only visible side
> effect.
> 
> So, where has my missing node(s) gone?

Do you perform the node addition on the event dispatch thread (EDT)? You 
ought to.

-- 
DF.

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

Back to comp.lang.java.gui | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

JTree - subnode not added "pelakh" <pelakh@THRWHITE.remove-dii-this> - 2011-04-27 15:47 +0000
  Re: JTree - subnode not a "Daniele Futtorovic" <daniele.futtorovic@THRWHITE.remove-dii-this> - 2011-04-27 15:47 +0000
    Re: JTree - subnode not a "John B. Matthews" <john.b..matthews@THRWHITE.remove-dii-this> - 2011-04-27 15:47 +0000
      Re: JTree - subnode not a "pelakh" <pelakh@THRWHITE.remove-dii-this> - 2011-04-27 15:48 +0000

csiph-web