• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Rob Spoor
  • Henry Wong
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh
  • Jj Roberts

Problem in inserting tree in scrollpane

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 11445
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Add the tree to the scroll pane same way you added the scroll pane to the panel.
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
Thanks For your reply.SetviewPortview really worked. thanks.
Regards,
Gnanaprakasam
 
If you were a tree, what sort of tree would you be? This tiny ad is a poop beast.
SKIP - a book about connecting industrious people with elderly land owners
https://coderanch.com/t/skip-book
reply
    Bookmark Topic Watch Topic
  • New Topic