rem ' Define tree data
dim music$[2,4]
music$[0,0]="The Beatles"
music$[0,1]="Hey Jude"
music$[0,2]="Let It Be"
music$[0,3]="Twist and Shout"
music$[0,4]="Yesterday"
music$[1,0]="Paul Simon"
music$[1,1]="Bridge Over Troubled Water"
music$[1,2]="Hearts and Bones"
music$[1,3]="Kathy's Song"
music$[1,4]="The Sound of Silence"
music$[2,0]="Willie Nelson"
music$[2,1]="Always On My Mind"
music$[2,2]="Getting Over You"
music$[2,3]="Old Fords and Natural Stone"
music$[2,4]="This Morning"
dim image$[2,4]
rem ' fill in filenames here to set node-specific icons
image$[0,0]=""; rem "The Beatles"
image$[0,1]=""; rem "Hey Jude"
image$[0,2]=""; rem "Let It Be"
image$[0,3]=""; rem "Twist and Shout"
image$[0,4]=""; rem "Yesterday"
image$[1,0]=""; rem "Paul Simon"
image$[1,1]=""; rem "Bridge Over Troubled Water"
image$[1,2]=""; rem "Hearts and Bones"
image$[1,3]=""; rem "Kathy's Song"
image$[1,4]=""; rem "The Sound of Silence"
image$[2,0]=""; rem "Willie Nelson"
image$[2,1]=""; rem "Always On My Mind"
image$[2,2]=""; rem "Getting Over You"
image$[2,3]=""; rem "Old Fords and Natural Stone"
image$[2,4]=""; rem "This Morning"
rem ' Create and populate tree
tree! = window!.addTree(101,25,25,200,200)
tree!.putClientProperty("JTree.lineStyle","None")
tree!.setBackColor(window!.getBackColor())
tree!.setSelectionMode(tree!.SINGLE_TREE_SELECTION)
tree!.setCollapsedIcon("collapsed.gif",err=*next)
tree!.setExpandedIcon("expanded.gif",err=*next)
tree!.setLeafIcon("leaf.png",err=*next)
tree!.setSelectedIcon("selected.png",err=*next)
root = 0
node = 0
root$ = "Musical Tree"
root$ = "<html><h2>" + root$ + " " + str(root) + "</h2></html>"
tree!.setRoot(root,root$)
tree!.setToolTipText(root,root$)
color! = sysgui!.makeColor(rnd(255),rnd(255),rnd(255))
tree!.setNodeForeColor(root,color!)
for artist = 0 to 2
node = node + 1
artist$ = "<html><h3>"+music$[artist,0]+" "+str(node)+"</h3></html>"
tree!.addExpandableNode(node,root,artist$)
tree!.expandNode(node)
tree!.setToolTipText(node,artist$)
color! = sysgui!.makeColor(rnd(255),rnd(255),rnd(255))
tree!.setNodeForeColor(node,color!)
if len(image$[artist,0]) then
tree!.setNodeIcon(node,image$[artist,0])
endif
parent = node
for song = 1 to 4
node = node + 1
song$ = music$[artist,song]+" "+str(node)
tree!.addNode(node,parent,song$)
tree!.setToolTipText(node,song$)
color! = sysgui!.makeColor(rnd(255),rnd(255),rnd(255))
tree!.setNodeForeColor(node,color!)
if len(image$[artist,song]) then
tree!.setNodeIcon(node,image$[artist,song])
endif
next song
next artist