• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem in inserting tree in scrollpane

 
GnanaPrakasam Rathinasabapathi
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I have problem in inserting the tree and its nodes in scrollpane.Please help me.My code goes here.

Please suggest me a solution.Thanks in advance.
Regards,
Gnanaprakasam
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well the usual way is to wrap the tree in a scrollpane and then add the scroll pane to the parent container
e.g.
JPanel#add(new JScrollPane(new JTree());


Is this what you are asking or did I misunderstand your question?
 
GnanaPrakasam Rathinasabapathi
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Maneesh Godbole,
Ya.You have understood the right thing only. I am using netbeans IDE. I have added the scrollpane to a splitpane's left component which in turn added to a panel statically.Similar to what you have told. The thing is i cant add the tree dynamically in this scrollpane. Thanks.Waiting for your reply.
Regards,
Gnanaprakasam
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Add the tree to the scroll pane same way you added the scroll pane to the panel.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> The thing is i cant add the tree dynamically in this scrollpane.

if this is how you're trying to do

jScrollPane5.add(tree);

then it's the wrong way

jScrollPane5.setViewportView(tree);

should work
 
GnanaPrakasam Rathinasabapathi
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
Thanks For your reply.SetviewPortview really worked. thanks.
Regards,
Gnanaprakasam
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!