This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Urgent!! How to add a component to a JScrollPane?  RSS feed

 
Tris Rabar
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,
I'm not sure if the following can be done but if it can, could someone please tell me how?
I have a JTree displayed, on a JScrollPane, on a JSplitPane. Is it possible for me to add another JTree on this same view, under the previous one?

Thanks for any assistance!!
 
Kay Tracid
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Add your tree AND the other component to a panel. You add this panel to your scrollpane.
 
Tris Rabar
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's how it works:
The first JTree is on the scrollpane. Then I click a button that adds another JTree to the same pane, but the contents and selections of the first tree are preserved. (The JTrees have checkboxes rendered on their nodes so that selections are checked). A click of another button adds another similar tree, preserving the contents of the first two, and so on.
Thanks..
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!