• Post Reply Bookmark Topic Watch Topic
  • New Topic

How do you make a JTree using Forte for Java?

 
Sonny Pondrom
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Has anyone seen a tutorial showing how to make a JTree? It is easy enough to make a JFrame, add a JScollPane and then drop a JTree into it. But that only gets you a default tree. I would like to see how to use customized TreeNode and TreeModel classes.
 
Guoqiao Sun
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Sonny:
There is a good sample about JTree with the JDk distribution. Suppose you installed JDK at %JAVA_HOME%, the mentioned sample locates at %JAVA_HOME%\demo\jfc\SampleTree, run it with
java -jar SampleTree.jar
And you can get what you want.
Regards,

Originally posted by Sonny Pondrom:
Has anyone seen a tutorial showing how to make a JTree? It is easy enough to make a JFrame, add a JScollPane and then drop a JTree into it. But that only gets you a default tree. I would like to see how to use customized TreeNode and TreeModel classes.


------------------
Guoqiao Sun
Sun Certified Programmer for Java™ 2 Platform
try my mock exam¹²³ at my homepage.
 
Sonny Pondrom
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Guoqiao,
I found out that in the Forte IDE, if you change the "model" property in the Component Inspector to the name of your customized TreeModel, it will initialize the JTree properly.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!