I write most of my QTP script using descriptive programming, so this function may look a little different than the ones you write using the object repository. Also, a few of the lines wrapped when I pasted the code here.
The function is called with vTree, which equals the JaveTree index. In my case, there was only 1 JavaTree on the page so it was indes = 0. The function returns a pipe-delimited string containing each item displayed in the fully opened tree.
vItems = fSplitJavaTree(0)
The nested For-loops determine how deep you need to go to get each leaf, but can be shortened or expanded as needed.
Since I didn't want the full path returned (just the last part, which equals the displayed text) I included the last For-Loop to grap the text after the last ";"
Hope this helps

GeSHi (qtp):
Function fSplitJavaTree
(vTree
)'Returns String Separated w/ "|" Dim oDesc
vCollection =
"|" Set oDesc =
Description.
Create() Set objLink = Browser
("Index:=0").
Page("Index:=0").
JavaApplet("Index:=0").
JavaTree("Index:="&vTree
) objLink.
Highlight 'Expand Level 0 vLevel_0 =
0 objLink.
Expand "#"&vLevel_0
'Expand Level 1 On Error Resume Next For vLevel_1 =
1 to 3 objLink.
Expand "#"&vLevel_0 &
";#" & vLevel_1
'Expand Level 2 For vLevel_2 =
0 to 3 objLink.
Expand "#"&vLevel_0 &
";#" & vLevel_1 &
";#" & vLevel_2
'Expand Level 3 For vLevel_3 =
0 to 3 objLink.
Expand "#"&vLevel_0 &
";#" & vLevel_1 &
";#" & vLevel_2 &
";#" & vLevel_3
'Expand Level 4 For vLevel_4 =
0 to 3 objLink.
Expand "#"&vLevel_0 &
";#" & vLevel_1 &
";#" & vLevel_2 &
";#" & vLevel_3 &
";#" & vLevel_4
Next Next Next Next vCount = objLink.
GetROProperty("items count") For i =
1 To vCount -
1 vStage1 = objLink.
GetItem(""&i&
"") vStage1_array =
split(vStage1,
";") vLastPart =
UBound(vStage1_array
) vCollection = vCollection & vStage1_array
(vLastPart
) +
"|" Next fSplitJavaTree = vCollection
End Function Created by GeSHI 1.0.7.20