Re: JTree display update issue with new nodes
- From: Dan Andrews <danharrisandrews@xxxxxxxxx>
- Date: Wed, 27 Sep 2006 09:39:26 -0600
qu0ll wrote:
Thanks Dan. Please see my recent reply to Bart about this. You are absolutely spot on.
Hi qu0ll,
(1) Your code does this and a blank node is displayed (no userObject is specified):
DefaultMutableTreeNode childNode = new DefaultMutableTreeNode();
(2) The DefaultTreeCellRenderer does this:
String stringValue = tree.convertValueToText(value, sel,
expanded, leaf, row, hasFocus);
setText(stringValue);
(3) And the JTree's convertValueToText does this:
if(value != null) {
String sValue = value.toString();
if (sValue != null) {
return sValue;
}
}
return "";
(4) And the DefaultMutableTreeNode is the value and has no userObject so null is returned in it's toString like this:
if (userObject == null) {
return null;
} else {
return userObject.toString();
}
Cheers,
Dan Andrews
- - - - - - - - - - - - - - - - - - - - - - - - -
Ansir Development Limited http://www.ansir.ca
- - - - - - - - - - - - - - - - - - - - - - - - -
.
- References:
- JTree display update issue with new nodes
- From: qu0ll
- Re: JTree display update issue with new nodes
- From: Dan Andrews
- Re: JTree display update issue with new nodes
- From: qu0ll
- JTree display update issue with new nodes
- Prev by Date: Re: JTree display update issue with new nodes - SOLVED
- Next by Date: Re: Can JOptionPane use a MaskFormatter for data input
- Previous by thread: Re: JTree display update issue with new nodes
- Next by thread: Can JOptionPane use a MaskFormatter for data input
- Index(es):
Relevant Pages
|
|