The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
April 2001

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

Jtree node renering problem

Posted by Eoin Wren on April 10, 2001 at 11:43 AM

Hi,

I am having a problem with a Jtree that maybe somebody can help me with.

The names that I display on the nodes on the tree vary depending on the states of various objects in my application. In order to change the names of the nodes, I have create a Renderer class which extends DefaultTreeCellRenderer. In that class I have a getTreeCellRendererComponent method..and in there I use the setText method to set the name of the node.....for example

setText(myAppObj.getStatus());

This works fine when the application loads and the tree is first built...however if I change the status of the objects in my application, and generate an event which causes the tree to be updated, the node names are now truncated..

so if myAppObj has a state of "open.Running"
its initially displayed in the tree as open.Running

however when I change the state of myAppObj to "closed.completed"

and cause the tree to be updated..it now appears as
closed.com...

in other words its truncated..
It makes no difference is the new node name is longer or shorter than the old node name.

Does anybody have any ideas why this might be happening..



Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us