This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Urgent!! How to add a component to a JScrollPane? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply Bookmark "Urgent!! How to add a component to a JScrollPane?" Watch "Urgent!! How to add a component to a JScrollPane?" New topic
Author

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

Tris Rabar
Ranch Hand

Joined: Feb 27, 2002
Posts: 72
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!!


- Trish -
Kay Tracid
Ranch Hand

Joined: Mar 06, 2002
Posts: 148
Add your tree AND the other component to a panel. You add this panel to your scrollpane.
Tris Rabar
Ranch Hand

Joined: Feb 27, 2002
Posts: 72
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..
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Urgent!! How to add a component to a JScrollPane?
 
Similar Threads
JTree
JTree
JTable In JTree
JTree resizing issue
JTree