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


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

Re: Struggling with Swing

From "Rogan Dawes" <rogan.dawes@THRWHITE.remove-dii-this>
Subject Re: Struggling with Swing
Message-ID <q7SdnbiYCbvZdcPaRVnyiwA@saix.net> (permalink)
Newsgroups comp.lang.java.gui
References <iLadnTTQkKBeKsPanZ2dnUVZ8qKvnZ2d@saix.net>
Date 2011-04-27 15:41 +0000
Organization TDS.net

Show all headers | 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