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


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

Re: Struggling with Swing

Path csiph.com!x330-a1.tempe.blueboxinc.net!feeder1.hal-mli.net!news.glorb.com!news-out.readnews.com!transit3.readnews.com!news-out.news.tds.net!newsreading01.news.tds.net!86597e80!not-for-mail
From "Rogan Dawes" <rogan.dawes@THRWHITE.remove-dii-this>
Subject Re: Struggling with Swing
Message-ID <q7SdnbiYCbvZdcPaRVnyiwA@saix.net> (permalink)
X-Comment-To comp.lang.java.gui
Newsgroups comp.lang.java.gui
In-Reply-To <iLadnTTQkKBeKsPanZ2dnUVZ8qKvnZ2d@saix.net>
References <iLadnTTQkKBeKsPanZ2dnUVZ8qKvnZ2d@saix.net>
Content-Type text/plain; charset=IBM437
Content-Transfer-Encoding 8bit
X-Gateway time.synchro.net [Synchronet 3.15a-Win32 NewsLink 1.92]
Lines 46
Date Wed, 27 Apr 2011 15:41:37 GMT
NNTP-Posting-Host 96.60.20.240
X-Complaints-To news@tds.net
X-Trace newsreading01.news.tds.net 1303918897 96.60.20.240 (Wed, 27 Apr 2011 10:41:37 CDT)
NNTP-Posting-Date Wed, 27 Apr 2011 10:41:37 CDT
Organization TDS.net
Xref x330-a1.tempe.blueboxinc.net comp.lang.java.gui:2869

Show key headers only | View raw


  To: comp.lang.java.gui
Rogan Dawes wrote:
> Hi folks,
> 
> I am struggling to figure out what I am doing wrong in this TreeModel 
> implementation. It seems like certain nodes are not being rendered, even 
> though I can see that the (custom) renderer *is* actually being called 
> for all the rows. Which is just weird!
> 
> I am trying to show a JSON Object hierarchy in a JTree (actually a 
> SwingX JXTreeTable, which is where this first manifested).
> 
> The example shows a broken example, and a working example (if you 
> uncomment the code in main() at the bottom). As can be seen from the 
> println statements in the TreeCellRenderer, it *is* being called for 
> each row, but the row is not actually being rendered at all.
> 
> The obvious difference between the two examples is that the non-rendered 
> nodes now have a child, but I'd hope that that shouldn't make any real 
> difference!
> 
> Any ideas?
> 
> Rogan
> 

Gah!

Replying to myself! :-(

So, it turns out that the problem is in the TreePath code, since it 
doesn't use == for equality checks, but rather .equals().

Since the empty maps are equivalent, the TreePaths constructed are 
equals(). Which means that the JTree gets confused :-(

See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4257782

So much for that!

Rogan

---
 * 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 | Find similar | Unroll thread


Thread

Struggling with Swingx Tr "Rogan Dawes" <rogan.dawes@THRWHITE.remove-dii-this> - 2011-04-27 15:41 +0000
  Re: Struggling with Swing "Rogan Dawes" <rogan.dawes@THRWHITE.remove-dii-this> - 2011-04-27 15:41 +0000

csiph-web